133 #include "../core/stdafx.hpp"
141 #include "../ext/OTPayment.hpp"
143 #include "../cash/Mint.hpp"
144 #include "../cash/Purse.hpp"
145 #include "../cash/Token.hpp"
147 #include "../basket/Basket.hpp"
149 #include "../core/recurring/OTPaymentPlan.hpp"
150 #include "../core/OTAccount.hpp"
151 #include "../core/script/OTAgent.hpp"
152 #include "../core/OTAssetContract.hpp"
153 #include "../core/crypto/OTAsymmetricKey.hpp"
154 #include "../core/script/OTBylaw.hpp"
155 #include "../core/OTCheque.hpp"
156 #include "../core/script/OTClause.hpp"
157 #include "../core/crypto/OTCredential.hpp"
158 #include "../core/crypto/OTEnvelope.hpp"
159 #include "../core/OTLedger.hpp"
160 #include "../core/OTLog.hpp"
161 #include "../core/OTMessage.hpp"
162 #include "../core/script/OTParty.hpp"
163 #include "../core/script/OTPartyAccount.hpp"
164 #include "../core/crypto/OTPasswordData.hpp"
165 #include "../core/util/OTPaths.hpp"
166 #include "../core/OTPseudonym.hpp"
167 #include "../core/OTServerContract.hpp"
168 #include "../core/crypto/OTSymmetricKey.hpp"
176 #define OT_BOOL int32_t
211 if (
nullptr != tmpOTAPI) {
293 std::string strNumber;
294 std::stringstream strstream;
296 strstream << lNumber;
297 strstream >> strNumber;
309 std::string strNumber;
310 std::stringstream strstream;
312 strstream << lNumber;
313 strstream >> strNumber;
323 const std::string& strOutput)
const
325 const OTString otstrOutput(!strOutput.empty() ? strOutput :
"\n");
333 if (!bIsInitialized) {
334 otErr << __FUNCTION__ <<
": Error: OT_API not Initialized!!\n";
338 OTString sWalletFilename(strWalletFilename);
340 if (sWalletFilename.
Exists()) {
344 otErr << __FUNCTION__ <<
": Error:: Wallet Filename is Null!\n";
430 const std::string& strNumbers)
const
433 if (!bIsInitialized) {
434 otErr << __FUNCTION__
435 <<
": Not initialized; call OT_API::Init first.\n";
438 if (strNumbers.empty()) {
439 otErr << __FUNCTION__ <<
": Null: strNumbers passed in!\n";
444 OTNumList theList, theNewNumbers(strNumbers);
446 if (
"" != strNumList) {
447 const OTString otstrNumList(strNumList);
448 theList.Add(otstrNumList);
454 if (bAdded && theList.
Output(strOutput)) {
455 std::string pBuf = strOutput.
Get();
467 const std::string& strNumbers)
const
470 if (!bIsInitialized) {
471 otErr << __FUNCTION__
472 <<
": Not initialized; call OT_API::Init first.\n";
476 if (strNumList.empty()) {
477 otErr << __FUNCTION__ <<
": Null: strNumList passed in!\n";
480 if (strNumbers.empty()) {
481 otErr << __FUNCTION__ <<
": Null: strNumbers passed in!\n";
485 OTNumList theList(strNumList), theNewNumbers(strNumbers);
490 if (bRemoved && theList.Output(strOutput)) {
491 std::string pBuf = strOutput.
Get();
502 const std::string& strNumbers)
const
505 if (!bIsInitialized) {
506 otErr << __FUNCTION__
507 <<
": Not initialized; call OT_API::Init first.\n";
511 if (strNumList.empty()) {
512 otErr << __FUNCTION__ <<
": Null: strNumList passed in!\n";
515 if (strNumbers.empty()) {
516 otErr << __FUNCTION__ <<
": Null: strNumbers passed in!\n";
520 OTNumList theList(strNumList), theNewNumbers(strNumbers);
522 const bool& bVerified =
525 return bVerified ?
true :
false;
531 const std::string& strNumbers)
const
534 if (!bIsInitialized) {
535 otErr << __FUNCTION__
536 <<
": Not initialized; call OT_API::Init first.\n";
539 if (strNumList.empty()) {
540 otErr << __FUNCTION__ <<
": Null: strNumList passed in!\n";
543 if (strNumbers.empty()) {
544 otErr << __FUNCTION__ <<
": Null: strNumbers passed in!\n";
547 OTNumList theList(strNumList), theNewNumbers(strNumbers);
551 return bVerified ?
true :
false;
557 if (!bIsInitialized) {
558 otErr << __FUNCTION__
559 <<
": Not initialized; call OT_API::Init first.\n";
562 if (strNumList.empty()) {
563 otErr << __FUNCTION__ <<
": Null: strNumList passed in!\n";
584 const int32_t& nKeySize,
585 const std::string& NYM_ID_SOURCE,
586 const std::string& ALT_LOCATION)
const
589 otErr << __FUNCTION__
590 <<
": Keysize is 0 or less, will fail! Try 1024.\n";
594 OTAPI()->CreateNym(nKeySize, NYM_ID_SOURCE, ALT_LOCATION);
597 otOut << __FUNCTION__ <<
": Failed trying to create Nym.\n";
603 if (strOutput.
Exists())
return strOutput.
Get();
608 const std::string& NYM_ID,
const std::string& SERVER_ID)
const
610 if (NYM_ID.empty()) {
611 otErr << __FUNCTION__ <<
": nullptr NYM_ID passed in!\n";
614 if (SERVER_ID.empty()) {
615 otErr << __FUNCTION__ <<
": nullptr SERVER_ID passed in!\n";
620 std::string str_return;
624 numlist.
Output(strOutput);
625 str_return = strOutput.
Get();
632 int64_t lTransNum)
const
634 if (SERVER_ID.empty()) {
635 otErr << __FUNCTION__ <<
": nullptr SERVER_ID passed in!\n";
639 otErr << __FUNCTION__ <<
": Negative: lTransNum passed in!\n";
643 std::string str_return;
644 const int64_t lTransactionNum =
static_cast<int64_t
>(lTransNum);
646 std::unique_ptr<OTCronItem> pCronItem(
648 if (
nullptr != pCronItem) {
649 const OTString strCronItem(*pCronItem);
651 str_return = strCronItem.
Get();
658 if (NYM_ID.empty()) {
659 otErr << __FUNCTION__ <<
": nullptr NYM_ID passed in!\n";
668 if (
nullptr == pNym)
return "";
674 const std::string& NYM_ID)
const
676 if (NYM_ID.empty()) {
677 otErr << __FUNCTION__ <<
": nullptr NYM_ID passed in!\n";
686 if (
nullptr == pNym)
return "";
693 if (NYM_ID.empty()) {
694 otErr << __FUNCTION__ <<
": nullptr NYM_ID passed in!\n";
703 if (
nullptr == pNym)
return (-1);
704 const int32_t nReturnValue =
710 const int32_t& nIndex)
const
712 if (NYM_ID.empty()) {
713 otErr << __FUNCTION__ <<
": nullptr NYM_ID passed in!\n";
722 if (
nullptr == pNym)
return "";
723 std::string str_return;
727 if (
nullptr != pCredential)
733 const std::string& NYM_ID,
const std::string& CREDENTIAL_ID)
const
735 if (NYM_ID.empty()) {
736 otErr << __FUNCTION__ <<
": nullptr NYM_ID passed in!\n";
745 if (
nullptr == pNym)
return "";
746 std::string str_return;
747 const OTString strCredID(CREDENTIAL_ID);
750 if (
nullptr != pCredential)
757 if (NYM_ID.empty()) {
758 otErr << __FUNCTION__ <<
": nullptr NYM_ID passed in!\n";
767 if (
nullptr == pNym)
return (-1);
768 const int32_t nReturnValue =
774 const int32_t& nIndex)
const
776 if (NYM_ID.empty()) {
777 otErr << __FUNCTION__ <<
": nullptr NYM_ID passed in!\n";
786 if (
nullptr == pNym)
return "";
787 std::string str_return;
791 if (
nullptr != pCredential) {
798 const std::string& NYM_ID,
const std::string& CREDENTIAL_ID)
const
800 if (NYM_ID.empty()) {
801 otErr << __FUNCTION__ <<
": nullptr NYM_ID passed in!\n";
810 if (
nullptr == pNym)
return "";
811 std::string str_return;
812 const OTString strCredID(CREDENTIAL_ID);
815 if (
nullptr != pCredential)
821 const std::string& NYM_ID,
const std::string& MASTER_CRED_ID)
const
823 if (NYM_ID.empty()) {
824 otErr << __FUNCTION__ <<
": nullptr NYM_ID passed in!\n";
827 if (MASTER_CRED_ID.empty()) {
828 otErr << __FUNCTION__ <<
": nullptr MASTER_CRED_ID passed in!\n";
837 if (
nullptr == pNym)
return (-1);
838 const OTString strCredID(MASTER_CRED_ID);
841 if (
nullptr != pCredential)
845 const int32_t nReturnValue =
static_cast<const int32_t
>(nSubCredCount);
853 const std::string& NYM_ID,
const std::string& MASTER_CRED_ID,
854 const int32_t& nIndex)
const
856 if (NYM_ID.empty()) {
857 otErr << __FUNCTION__ <<
": nullptr NYM_ID passed in!\n";
860 if (MASTER_CRED_ID.empty()) {
861 otErr << __FUNCTION__ <<
": nullptr MASTER_CRED_ID passed in!\n";
870 if (
nullptr == pNym)
return "";
871 const OTString strCredID(MASTER_CRED_ID);
874 if (
nullptr != pCredential)
876 static_cast<const int32_t>(nIndex));
882 const std::string& NYM_ID,
const std::string& MASTER_CRED_ID,
883 const std::string& SUB_CRED_ID)
const
885 if (NYM_ID.empty()) {
886 otErr << __FUNCTION__ <<
": nullptr NYM_ID passed in!\n";
889 if (MASTER_CRED_ID.empty()) {
890 otErr << __FUNCTION__ <<
": nullptr MASTER_CRED_ID passed in!\n";
893 if (SUB_CRED_ID.empty()) {
894 otErr << __FUNCTION__ <<
": nullptr SUB_CRED_ID passed in!\n";
903 if (
nullptr == pNym)
return "";
904 const OTString strCredID(MASTER_CRED_ID);
907 if (
nullptr != pCredential)
909 const OTString strSubID(SUB_CRED_ID);
918 const std::string& MASTER_CRED_ID,
919 const int32_t& nKeySize)
const
921 if (NYM_ID.empty()) {
922 otErr << __FUNCTION__ <<
": nullptr NYM_ID passed in!\n";
925 if (MASTER_CRED_ID.empty()) {
926 otErr << __FUNCTION__ <<
": nullptr MASTER_CRED_ID passed in!\n";
930 otErr << __FUNCTION__
931 <<
": Keysize is 0 or less, will fail! Try 1024.\n";
940 if (
nullptr == pNym)
return "";
941 const OTString strCredID(MASTER_CRED_ID);
944 if (
nullptr == pCredential)
945 otOut << __FUNCTION__ <<
": Sorry, (Nym " << NYM_ID
946 <<
") no master credential found with the ID: " << strCredID
954 pNym->
AddNewSubkey(idMasterCredential, nKeySize,
nullptr,
955 &thePWData, &strNewSubcredID);
958 return strNewSubcredID.
Get();
961 otErr << __FUNCTION__
962 <<
": Failed trying to add new subcredential.\n";
968 const std::string& MASTER_CRED_ID,
969 const std::string& SUB_CRED_ID)
const
971 if (NYM_ID.empty()) {
972 otErr << __FUNCTION__ <<
": nullptr NYM_ID passed in!\n";
975 if (MASTER_CRED_ID.empty()) {
976 otErr << __FUNCTION__ <<
": nullptr MASTER_CRED_ID passed in!\n";
979 if (SUB_CRED_ID.empty()) {
980 otErr << __FUNCTION__ <<
": nullptr SUB_CRED_ID passed in!\n";
989 if (
nullptr == pNym)
return false;
990 const OTString strCredID(MASTER_CRED_ID);
993 if (
nullptr == pCredential)
994 otOut << __FUNCTION__ <<
": Sorry, (Nym " << NYM_ID
995 <<
") no master credential found with the ID : " << strCredID
999 const OTString strSubID(SUB_CRED_ID);
1002 if (
nullptr == pSub)
1003 otOut << __FUNCTION__ <<
": Found master credential (" << strCredID
1004 <<
"), but unable to "
1005 "find subcredential with ID: " << strSubID <<
"\n";
1012 otErr <<
"\n\n\nOTAPI_Wrap::" << __FUNCTION__
1013 <<
": TODO: REVOKING IS NOT YET CODED. ADD FUNCTION CALL "
1014 "HERE TO REVOKE SUB-CREDENTIAL!\n\n\n";
1023 const std::string& str_Contract)
const
1026 if (!bIsInitialized) {
1027 otErr << __FUNCTION__
1028 <<
": Not initialized; call OT_API::Init first.\n";
1031 if (str_Contract.empty()) {
1032 otErr << __FUNCTION__ <<
": Null: str_Contract passed in!\n";
1035 std::string str_Trim(str_Contract);
1037 OTString strContract(str_Trim2.c_str());
1039 if (strContract.GetLength() < 2) {
1040 otOut << __FUNCTION__ <<
": Empty contract passed in!\n";
1048 const OTString strOutput(idOutput);
1049 std::string pBuf = strOutput.
Get();
1057 const std::string& str_Contract)
const
1060 if (!bIsInitialized) {
1061 otErr << __FUNCTION__
1062 <<
": Not initialized; call OT_API::Init first.\n";
1065 if (str_Contract.empty()) {
1066 otErr << __FUNCTION__ <<
": Null: str_Contract passed in!\n";
1069 std::string str_Trim(str_Contract);
1071 OTString strContract(str_Trim2.c_str());
1073 if (strContract.GetLength() < 2) {
1074 otOut << __FUNCTION__ <<
": Empty contract passed in!\n";
1082 const OTString strOutput(idOutput);
1083 std::string pBuf = strOutput.
Get();
1097 const std::string& NYM_ID,
const std::string& strXMLcontents)
const
1100 if (!bIsInitialized) {
1101 otErr << __FUNCTION__
1102 <<
": Not initialized; call OT_API::Init first.\n";
1106 if (NYM_ID.empty()) {
1107 otErr << __FUNCTION__ <<
": Null: NYM_ID passed in!\n";
1110 if (strXMLcontents.empty()) {
1111 otErr << __FUNCTION__ <<
": Null: strXMLcontents passed in!\n";
1117 if (
nullptr == pWallet)
return "";
1121 if (
nullptr == pNym)
return "";
1122 std::string str_Trim(strXMLcontents);
1124 OTString strContract(str_Trim2.c_str());
1126 if (strContract.GetLength() < 2) {
1127 otOut << __FUNCTION__ <<
": Empty XML contents passed in! (Failure.)\n";
1131 pContract->CreateContract(
1132 strContract, *pNym);
1135 const OTPseudonym* pContractKeyNym = pContract->GetContractPublicNym();
1138 if (
nullptr == pContractKeyNym) {
1139 otOut << __FUNCTION__ <<
": Missing 'key' tag with name=\"contract\" "
1140 "and text value containing the public cert or "
1141 "public key of the signer Nym. (Please add it "
1142 "first. Failure.)\n";
1145 else if (!pNym->
CompareID(*pContractKeyNym)) {
1146 otOut << __FUNCTION__ <<
": Found 'key' tag with name=\"contract\" and "
1147 "text value, but it apparently does NOT "
1148 "contain the public cert or public key of the "
1149 "signer Nym. Please fix that first; see the "
1150 "sample data. (Failure.)\n";
1175 if (!pContract->GetConnectInfo(strHostname, nPort)) {
1176 otOut << __FUNCTION__ <<
": Unable to retrieve connection info from "
1177 "this contract. Please fix that first; see "
1178 "the sample data. (Failure.)\n";
1189 pContract->CalculateContractID(idOutput);
1190 const OTString strOutput(idOutput);
1193 std::string pBuf = strOutput.
Get();
1199 const std::string& NYM_ID,
const std::string& strXMLcontents)
const
1202 if (!bIsInitialized) {
1203 otErr << __FUNCTION__
1204 <<
": Not initialized; call OT_API::Init first.\n";
1207 if (NYM_ID.empty()) {
1208 otErr << __FUNCTION__ <<
": Null: NYM_ID passed in!\n";
1211 if (strXMLcontents.empty()) {
1212 otErr << __FUNCTION__ <<
": Null: strXMLcontents passed in!\n";
1217 if (
nullptr == pWallet)
return "";
1221 if (
nullptr == pNym)
return "";
1222 std::string str_Trim(strXMLcontents);
1224 OTString strContract(str_Trim2.c_str());
1226 if (strContract.GetLength() < 2) {
1227 otOut << __FUNCTION__ <<
": Empty XML contents passed in! (Failure.)\n";
1231 pContract->CreateContract(
1232 strContract, *pNym);
1235 const OTPseudonym* pContractKeyNym = pContract->GetContractPublicNym();
1238 if (
nullptr == pContractKeyNym) {
1239 otOut << __FUNCTION__ <<
": Missing 'key' tag with name=\"contract\" "
1240 "and text value containing the public cert or "
1241 "public key of the signer Nym. (Please add it "
1242 "first. Failure.)\n";
1245 else if (!pNym->
CompareID(*pContractKeyNym)) {
1246 otOut << __FUNCTION__ <<
": Found 'key' tag with name=\"contract\" and "
1247 "text value, but it apparently does NOT "
1248 "contain the public cert or public key of the "
1249 "signer Nym. Please fix that first; see the "
1250 "sample data. (Failure.)\n";
1278 pContract->CalculateContractID(idOutput);
1279 const OTString strOutput(idOutput);
1282 std::string pBuf = strOutput.
Get();
1299 bool bIsInitialized = OTAPI()->IsInitialized();
1301 if (!bIsInitialized) {
1302 otErr << __FUNCTION__
1303 <<
": Not initialized; call OT_API::Init first.\n";
1306 if (SERVER_ID.empty()) {
1307 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
1313 if (
nullptr == pServer)
return "";
1315 const OTString strOutput(*pServer);
1316 std::string pBuf = strOutput.
Get();
1324 const std::string& str_input)
const
1327 if (!bIsInitialized) {
1328 otErr << __FUNCTION__
1329 <<
": Not initialized; call OT_API::Init first.\n";
1332 if (ASSET_TYPE_ID.empty()) {
1333 otErr << __FUNCTION__ <<
": Empty ASSET_TYPE_ID passed in!\n";
1350 const int64_t& THE_AMOUNT)
const
1353 if (!bIsInitialized) {
1354 otErr << __FUNCTION__
1355 <<
": Not initialized; call OT_API::Init first.\n";
1358 if (ASSET_TYPE_ID.empty()) {
1359 otErr << __FUNCTION__ <<
": Empty ASSET_TYPE_ID passed in!\n";
1373 if (
nullptr == pContract)
return "";
1375 const int64_t lAmount = THE_AMOUNT;
1376 int64_t theAmount(lAmount);
1378 std::string str_result;
1379 const bool bFormatted =
1381 const OTString strOutput(bFormatted ? str_result.c_str() : strBackup.
Get());
1383 std::string pBuf = strOutput.
Get();
1391 bool bIsInitialized = OTAPI()->IsInitialized();
1392 if (!bIsInitialized) {
1393 otErr << __FUNCTION__
1394 <<
": Not initialized; call OT_API::Init first.\n";
1398 if (ASSET_TYPE_ID.empty()) {
1399 otErr << __FUNCTION__ <<
": Null: ASSET_TYPE_ID passed in!\n";
1405 OTAPI()->GetAssetType(theAssetID, __FUNCTION__);
1406 if (
nullptr == pContract)
return "";
1408 const OTString strOutput(*pContract);
1409 std::string pBuf = strOutput.
Get();
1418 if (strContract.empty()) {
1419 otErr << __FUNCTION__ <<
": Null: strContract passed in!\n";
1424 if (
nullptr == pWallet)
return false;
1427 std::string str_Trim(strContract);
1429 OTString otstrContract(str_Trim2.c_str());
1437 if (otstrContract.Exists() &&
1438 pContract->LoadContractFromString(otstrContract)) {
1441 pContract->CalculateContractID(theContractID);
1442 pContract->SetIdentifier(theContractID);
1445 pContract =
nullptr;
1451 pContract =
nullptr;
1464 if (strContract.empty()) {
1465 otErr << __FUNCTION__ <<
": Null: strContract passed in!\n";
1470 if (
nullptr == pWallet)
return false;
1473 std::string str_Trim(strContract);
1475 OTString otstrContract(str_Trim2.c_str());
1484 if (otstrContract.Exists() &&
1485 pContract->LoadContractFromString(otstrContract)) {
1488 pContract->CalculateContractID(theContractID);
1489 pContract->SetIdentifier(theContractID);
1493 pContract =
nullptr;
1499 pContract =
nullptr;
1540 if (!bIsInitialized) {
1541 otErr << __FUNCTION__
1542 <<
": Not initialized; call OT_API::Init first.\n";
1545 if (SERVER_ID.empty()) {
1546 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
1553 for (int32_t i = 0; i < nCount; i++) {
1561 if (theID == theCompareID) {
1562 otOut << __FUNCTION__ <<
": Unable to remove server contract "
1563 << SERVER_ID <<
" from "
1564 "wallet, because Account " << strAcctID
1573 for (int32_t i = 0; i < nNymCount; i++) {
1579 otOut << __FUNCTION__ <<
": Unable to remove server contract "
1580 << SERVER_ID <<
" from "
1581 "wallet, because Nym " << strNymID
1582 <<
" is registered there. (Delete that first...)\n";
1599 if (!bIsInitialized) {
1600 otErr << __FUNCTION__
1601 <<
": Not initialized; call OT_API::Init first.\n";
1605 if (SERVER_ID.empty()) {
1606 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
1628 if (
nullptr == pWallet) {
1629 otErr << __FUNCTION__ <<
": No wallet found...\n";
1637 otOut << __FUNCTION__
1638 <<
": Removed server contract from the wallet: " << SERVER_ID
1656 if (!bIsInitialized) {
1657 otErr << __FUNCTION__
1658 <<
": Not initialized; call OT_API::Init first.\n";
1662 if (ASSET_ID.empty()) {
1663 otErr << __FUNCTION__ <<
": Null: ASSET_ID passed in!\n";
1671 for (int32_t i = 0; i < nCount; i++) {
1679 if (theID == theCompareID) {
1680 otOut << __FUNCTION__ <<
": Unable to remove asset contract "
1681 << ASSET_ID <<
" from "
1682 "wallet: Account " << strAcctID
1700 if (!bIsInitialized) {
1701 otErr << __FUNCTION__
1702 <<
": Not initialized; call OT_API::Init first.\n";
1706 if (ASSET_ID.empty()) {
1707 otErr << __FUNCTION__ <<
": Null: ASSET_ID passed in!\n";
1716 if (
nullptr == pWallet) {
1717 otErr << __FUNCTION__ <<
": No wallet found...!\n";
1725 otOut << __FUNCTION__
1726 <<
": Removed asset contract from the wallet: " << ASSET_ID
1746 if (!bIsInitialized) {
1747 otErr << __FUNCTION__
1748 <<
": Not initialized; call OT_API::Init first.\n";
1752 if (NYM_ID.empty()) {
1753 otErr << __FUNCTION__ <<
": Null: NYM_ID passed in!\n";
1759 if (
nullptr == pNym)
return false;
1766 for (int32_t i = 0; i < nCount; i++) {
1773 otErr << __FUNCTION__ <<
": Bug in OTAPI_Exec::Wallet_CanRemoveNym "
1774 "/ OTAPI_Exec::GetAccountWallet_NymID\n";
1781 if (theID == theCompareID) {
1782 otOut << __FUNCTION__ <<
": Nym cannot be removed because there "
1783 "are still accounts in the wallet for "
1794 for (int32_t i = 0; i < nServerCount; i++) {
1797 if (
"" != str_ServerID) {
1798 const OTString strServerID(str_ServerID);
1801 otOut << __FUNCTION__ <<
": Nym cannot be removed because "
1802 "there are still servers in the "
1803 "wallet that the Nym is registered "
1825 if (!bIsInitialized) {
1826 otErr << __FUNCTION__
1827 <<
": Not initialized; call OT_API::Init first.\n";
1831 if (NYM_ID.empty()) {
1832 otErr << __FUNCTION__ <<
": Null: NYM_ID passed in!\n";
1854 if (
nullptr == pWallet) {
1855 otErr << __FUNCTION__ <<
": No wallet found...!\n";
1862 otOut << __FUNCTION__ <<
": Success erasing Nym from wallet: " << NYM_ID
1868 otOut << __FUNCTION__ <<
": Failure erasing Nym from wallet: " << NYM_ID
1887 if (!bIsInitialized) {
1888 otErr << __FUNCTION__
1889 <<
": Not initialized; call OT_API::Init first.\n";
1893 if (ACCOUNT_ID.empty()) {
1894 otErr << __FUNCTION__ <<
": Null: ACCOUNT_ID passed in!\n";
1901 if (
nullptr == pAccount)
return false;
1904 otOut << __FUNCTION__ <<
": Account balance MUST be zero in order to "
1905 "close an asset account: " << ACCOUNT_ID
1909 bool BOOL_RETURN_VALUE =
false;
1916 std::unique_ptr<OTLedger> pInbox(
1918 std::unique_ptr<OTLedger> pOutbox(
1921 if (
nullptr == pInbox) {
1922 otOut << __FUNCTION__
1923 <<
": Failure calling OT_API::LoadInbox.\n Account ID : "
1924 << ACCOUNT_ID <<
"\n";
1926 else if (
nullptr == pOutbox) {
1927 otOut << __FUNCTION__
1928 <<
": Failure calling OT_API::LoadOutbox.\n Account ID : "
1929 << ACCOUNT_ID <<
"\n";
1931 else if ((pInbox->GetTransactionCount() > 0) ||
1932 (pOutbox->GetTransactionCount() > 0)) {
1933 otOut << __FUNCTION__ <<
": Failure: You cannot remove an asset "
1934 "account if there are inbox/outbox items "
1935 "still waiting to be processed.\n";
1938 BOOL_RETURN_VALUE =
true;
1940 return BOOL_RETURN_VALUE;
1947 const std::string& SERVER_ID,
1948 const std::string& USER_ID,
1949 const std::string& ACCOUNT_ID,
1951 const int32_t& nBoxType,
1952 const int64_t& TRANSACTION_NUMBER)
const
1955 if (SERVER_ID.empty()) {
1956 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
1959 if (USER_ID.empty()) {
1960 otErr << __FUNCTION__ <<
": Null: USER_ID passed in!\n";
1963 if (ACCOUNT_ID.empty()) {
1964 otErr << __FUNCTION__ <<
": Null: ACCOUNT_ID passed in!\n";
1967 if (!((0 == nBoxType) || (1 == nBoxType) || (2 == nBoxType))) {
1968 otErr << __FUNCTION__
1969 <<
": nBoxType is of wrong type: value: " << nBoxType <<
"\n";
1972 if (0 > TRANSACTION_NUMBER) {
1973 otErr << __FUNCTION__ <<
": Negative: TRANSACTION_NUMBER passed in!\n";
1976 const OTIdentifier theServerID(SERVER_ID), theUserID(USER_ID),
1977 theAccountID(ACCOUNT_ID);
1978 const int64_t lTransactionNum = TRANSACTION_NUMBER;
1985 otErr << __FUNCTION__ <<
": Error: bad nBoxType: " << nBoxType
1986 <<
" for UserID: " << USER_ID <<
" AcctID: " << ACCOUNT_ID
1987 <<
" (expected one of: 0/nymbox, 1/inbox, 2/outbox)\n";
1991 theServerID, theUserID, theAccountID,
1995 static_cast<int64_t>(lTransactionNum));
2009 const std::string& SERVER_ID,
const std::string& USER_ID,
2010 const std::string& ACCOUNT_ID,
2012 const int32_t& nBoxType,
2013 const int64_t& TRANSACTION_NUMBER)
const
2015 if (SERVER_ID.empty()) {
2016 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
2019 if (USER_ID.empty()) {
2020 otErr << __FUNCTION__ <<
": Null: USER_ID passed in!\n";
2023 if (ACCOUNT_ID.empty()) {
2024 otErr << __FUNCTION__ <<
": Null: ACCOUNT_ID passed in!\n";
2027 if (!((0 == nBoxType) || (1 == nBoxType) || (2 == nBoxType))) {
2028 otErr << __FUNCTION__
2029 <<
": nBoxType is of wrong type: value: " << nBoxType <<
"\n";
2032 if (0 > TRANSACTION_NUMBER) {
2033 otErr << __FUNCTION__ <<
": Negative: TRANSACTION_NUMBER passed in!\n";
2036 const OTIdentifier theServerID(SERVER_ID), theUserID(USER_ID),
2037 theAccountID(ACCOUNT_ID);
2038 const int64_t lTransactionNum = TRANSACTION_NUMBER;
2045 otErr << __FUNCTION__ <<
": Error: bad nBoxType: " << nBoxType
2046 <<
" for UserID: " << USER_ID <<
" AcctID: " << ACCOUNT_ID
2047 <<
"(expected one of: 0/nymbox, 1/inbox, 2/outbox)\n";
2056 static_cast<int64_t>(lTransactionNum));
2070 const std::string& USER_ID,
2071 const std::string& ACCOUNT_ID)
const
2073 if (SERVER_ID.empty()) {
2074 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
2077 if (USER_ID.empty()) {
2078 otErr << __FUNCTION__ <<
": Null: USER_ID passed in!\n";
2081 if (ACCOUNT_ID.empty()) {
2082 otErr << __FUNCTION__ <<
": Null: ACCOUNT_ID passed in!\n";
2088 OTIdentifier theServerID(SERVER_ID), theUserID(USER_ID),
2089 theAccountID(ACCOUNT_ID);
2102 if (!bIsInitialized) {
2103 otErr << __FUNCTION__
2104 <<
": Not initialized; call OT_API::Init first.\n";
2108 if (NYM_ID.empty()) {
2109 otErr << __FUNCTION__ <<
": Null: NYM_ID passed in!\n";
2133 std::string pBuf = strOutput.
Get();
2144 if (!bIsInitialized) {
2145 otErr << __FUNCTION__
2146 <<
": Not initialized; call OT_API::Init first.\n";
2150 if (NYM_ID.empty()) {
2151 otErr << __FUNCTION__ <<
": Null: NYM_ID passed in!\n";
2162 std::string pBuf = strOutput.
Get();
2179 if (!bIsInitialized) {
2180 otErr << __FUNCTION__
2181 <<
": Not initialized; call OT_API::Init first.\n";
2185 if (FILE_CONTENTS.empty()) {
2186 otErr << __FUNCTION__ <<
": Null: FILE_CONTENTS passed in!\n";
2193 const OTString strFileContents(FILE_CONTENTS);
2197 const bool& bImported =
2222 std::string pBuf = strNymID.
Get();
2241 const std::string& DISPLAY_NAME,
const std::string& FILE_CONTENTS)
const
2244 if (!bIsInitialized) {
2245 otErr << __FUNCTION__
2246 <<
": Not initialized; call OT_API::Init first.\n";
2253 if (FILE_CONTENTS.empty()) {
2254 otErr << __FUNCTION__ <<
": Null: FILE_CONTENTS passed in!\n";
2258 const OTString strDisplayName(DISPLAY_NAME), strFileContents(FILE_CONTENTS);
2262 const bool& bImported =
2268 std::string pBuf = strNymID.
Get();
2316 const std::string& PARTIAL_ID)
const
2323 if (!bIsInitialized) {
2324 otErr << __FUNCTION__
2325 <<
": Not initialized; call OT_API::Init first.\n";
2328 if (PARTIAL_ID.empty()) {
2329 otErr << __FUNCTION__ <<
": Null: PARTIAL_ID passed in!\n";
2338 OTAPI()->
GetNym(thePartialID,
"OTAPI_Exec::Wallet_GetNymIDFromPartial");
2340 if (
nullptr != pObject)
2342 OTString strID_Output(thePartialID);
2343 std::string pBuf = strID_Output.
Get();
2351 PARTIAL_ID,
"OTAPI_Exec::Wallet_GetNymIDFromPartial");
2353 if (
nullptr != pObject)
2357 std::string pBuf = strID_Output.
Get();
2368 const std::string& PARTIAL_ID)
const
2375 if (!bIsInitialized) {
2376 otErr << __FUNCTION__
2377 <<
": Not initialized; call OT_API::Init first.\n";
2381 if (PARTIAL_ID.empty()) {
2382 otErr << __FUNCTION__ <<
": Null: PARTIAL_ID passed in!\n";
2391 thePartialID,
"OTAPI_Exec::Wallet_GetServerIDFromPartial");
2393 if (
nullptr != pObject)
2395 OTString strID_Output(thePartialID);
2396 std::string pBuf = strID_Output.
Get();
2404 PARTIAL_ID,
"OTAPI_Exec::Wallet_GetServerIDFromPartial");
2406 if (
nullptr != pObject)
2410 std::string pBuf = strID_Output.
Get();
2422 const std::string& PARTIAL_ID)
const
2430 if (!bIsInitialized) {
2431 otErr << __FUNCTION__
2432 <<
": Not initialized; call OT_API::Init first.\n";
2436 if (PARTIAL_ID.empty()) {
2437 otErr << __FUNCTION__ <<
": Null: PARTIAL_ID passed in!\n";
2447 thePartialID,
"OTAPI_Exec::Wallet_GetAssetIDFromPartial");
2449 if (
nullptr != pObject)
2451 OTString strID_Output(thePartialID);
2452 std::string pBuf = strID_Output.
Get();
2460 PARTIAL_ID,
"OTAPI_Exec::Wallet_GetAssetIDFromPartial");
2462 if (
nullptr != pObject)
2466 std::string pBuf = strID_Output.
Get();
2475 const std::string& PARTIAL_ID)
const
2483 if (!bIsInitialized) {
2484 otErr << __FUNCTION__
2485 <<
": Not initialized; call OT_API::Init first.\n";
2489 if (PARTIAL_ID.empty()) {
2490 otErr << __FUNCTION__ <<
": Null: PARTIAL_ID passed in!\n";
2500 thePartialID,
"OTAPI_Exec::Wallet_GetNymIDFromPartial");
2502 if (
nullptr != pObject)
2504 OTString strID_Output(thePartialID);
2505 std::string pBuf = strID_Output.
Get();
2513 PARTIAL_ID,
"OTAPI_Exec::Wallet_GetNymIDFromPartial");
2515 if (
nullptr != pObject)
2519 std::string pBuf = strID_Output.
Get();
2531 otErr << __FUNCTION__
2532 <<
": nIndex is out of bounds (it's in the negative!)\n";
2539 bool bGetNym =
OTAPI()->
GetNym(nIndex, theNymID, strName);
2544 std::string pBuf = strNymID.
Get();
2555 if (NYM_ID.empty()) {
2556 otErr << __FUNCTION__ <<
": Null NYM_ID passed in!\n";
2562 if (
nullptr != pNym) {
2564 std::string pBuf = strName.
Get();
2572 const std::string& SERVER_ID)
const
2574 if (NYM_ID.empty()) {
2575 otErr << __FUNCTION__ <<
": Null: NYM_ID passed in!\n";
2578 if (SERVER_ID.empty()) {
2579 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
2583 const OTIdentifier theNymID(NYM_ID), theServerID(SERVER_ID);
2587 return (bSuccess) ?
true :
false;
2594 if (NYM_ID.empty()) {
2595 otErr << __FUNCTION__ <<
": Null: NYM_ID passed in!\n";
2602 if (
nullptr != pNym) {
2607 std::string pBuf = strOutput.
Get();
2618 const std::string& SERVER_ID,
2619 const std::string& NYM_ID)
const
2621 if (NYM_ID.empty()) {
2622 otErr << __FUNCTION__ <<
": Null: NYM_ID passed in!\n";
2625 if (SERVER_ID.empty()) {
2626 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
2631 OTPseudonym* pNym = OTAPI()->GetNym(theNymID, __FUNCTION__);
2633 if (
nullptr != pNym) {
2635 const std::string str_server_id(SERVER_ID);
2637 str_server_id, theNymboxHash);
2649 <<
": NymboxHash not found, on client side, for server "
2650 << str_server_id <<
" and nym " << strNymID
2651 <<
". (Returning .)\n";
2657 std::string pBuf = strOutput.
Get();
2669 const std::string& SERVER_ID,
2670 const std::string& NYM_ID)
const
2672 if (NYM_ID.empty()) {
2673 otErr << __FUNCTION__ <<
": Null: NYM_ID passed in!\n";
2676 if (SERVER_ID.empty()) {
2677 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
2682 OTPseudonym* pNym = OTAPI()->GetNym(theNymID, __FUNCTION__);
2684 if (
nullptr != pNym) {
2686 const std::string str_server_id(SERVER_ID);
2687 const bool& bGothash =
2700 <<
": RecentHash not found, on client side, for server "
2701 << str_server_id <<
" and nym " << strNymID
2702 <<
". (Returning .)\n";
2708 std::string pBuf = strOutput.
Get();
2718 const std::string& NYM_ID)
2722 if (ACCOUNT_ID.empty()) {
2723 otErr << __FUNCTION__ <<
": Null: ACOUNT_ID passed in!\n";
2726 if (NYM_ID.empty()) {
2727 otErr << __FUNCTION__ <<
": Null: NYM_ID passed in!\n";
2732 OTPseudonym* pNym = OTAPI()->GetNym(theNymID, __FUNCTION__);
2734 if (
nullptr != pNym) {
2736 const std::string str_acct_id(ACCOUNT_ID);
2737 const bool& bGothash =
2750 <<
": InboxHash not found, on client side, for account "
2751 << str_acct_id <<
" and nym " << strNymID
2752 <<
". (Returning .)\n";
2758 std::string pBuf = strOutput.
Get();
2768 const std::string& NYM_ID)
2772 if (ACCOUNT_ID.empty()) {
2773 otErr << __FUNCTION__ <<
": Null: ACCOUNT_ID passed in!\n";
2776 if (NYM_ID.empty()) {
2777 otErr << __FUNCTION__ <<
": Null: NYM_ID passed in!\n";
2782 OTPseudonym* pNym = OTAPI()->GetNym(theNymID, __FUNCTION__);
2784 if (
nullptr != pNym) {
2786 const std::string str_acct_id(ACCOUNT_ID);
2787 const bool& bGothash =
2800 <<
": OutboxHash not found, on client side, for account "
2801 << str_acct_id <<
" and nym " << strNymID
2802 <<
". (Returning .)\n";
2808 std::string pBuf = strOutput.
Get();
2819 if (NYM_ID.empty()) {
2820 otErr << __FUNCTION__ <<
": Null: NYM_ID passed in!\n";
2825 if (
nullptr == pNym)
return -1;
2831 const int32_t& nIndex)
const
2833 if (NYM_ID.empty()) {
2834 otErr << __FUNCTION__ <<
": Null: NYM_ID passed in!\n";
2838 otErr << __FUNCTION__
2839 <<
": nIndex is out of bounds (it's in the negative!)\n";
2844 if (
nullptr == pNym)
return "";
2847 if (
nullptr != pMessage) {
2857 theEnvelope.
Open(*pNym, strEnvelopeContents)) {
2858 std::string pBuf = strEnvelopeContents.
Get();
2868 const int32_t& nIndex)
const
2870 if (NYM_ID.empty()) {
2871 otErr << __FUNCTION__ <<
": Null: NYM_ID passed in!\n";
2875 otErr << __FUNCTION__
2876 <<
": nIndex is out of bounds (it's in the negative!)\n";
2881 if (
nullptr == pNym)
return "";
2884 if (
nullptr != pMessage) {
2899 const int32_t& nIndex)
const
2901 if (NYM_ID.empty()) {
2902 otErr << __FUNCTION__ <<
": Null: NYM_ID passed in!\n";
2907 otErr << __FUNCTION__
2908 <<
": nIndex is out of bounds (it's in the negative!)\n";
2914 if (
nullptr == pNym)
return "";
2917 if (
nullptr != pMessage) {
2930 const int32_t& nIndex)
const
2932 if (NYM_ID.empty()) {
2933 otErr << __FUNCTION__ <<
": Null: NYM_ID passed in!\n";
2937 otErr << __FUNCTION__
2938 <<
": nIndex is out of bounds (it's in the negative!)\n";
2943 if (
nullptr == pNym)
return false;
2952 otErr << __FUNCTION__ <<
": Error saving Nym: " << NYM_ID <<
"\n";
2977 const int32_t& nIndex)
const
2979 if (NYM_ID.empty()) {
2980 otErr << __FUNCTION__ <<
": Null: NYM_ID passed in!\n";
2984 otErr << __FUNCTION__
2985 <<
": nIndex is out of bounds (it's in the negative!)\n";
2990 if (
nullptr == pNym)
return false;
2993 if (
nullptr != pMessage) {
3003 if (
nullptr != pSenderNym) {
3015 if (NYM_ID.empty()) {
3016 otErr << __FUNCTION__ <<
": Null: NYM_ID passed in!\n";
3021 if (
nullptr == pNym)
return -1;
3027 const std::string& NYM_ID,
const int32_t& nIndex)
const
3029 if (NYM_ID.empty()) {
3030 otErr << __FUNCTION__ <<
": Null: NYM_ID passed in!\n";
3034 otErr << __FUNCTION__
3035 <<
": nIndex is out of bounds (it's in the negative!)\n";
3040 if (
nullptr == pNym)
return "";
3042 if (
nullptr != pMessage) {
3050 std::string pBuf = strMailContents.
Get();
3060 const std::string& NYM_ID,
const int32_t& nIndex)
const
3062 if (NYM_ID.empty()) {
3063 otErr << __FUNCTION__ <<
": Null: NYM_ID passed in!\n";
3067 otErr << __FUNCTION__
3068 <<
": nIndex is out of bounds (it's in the negative!)\n";
3073 if (
nullptr == pNym)
return "";
3075 if (
nullptr != pMessage) {
3090 const std::string& NYM_ID,
const int32_t& nIndex)
const
3092 if (NYM_ID.empty()) {
3093 otErr << __FUNCTION__ <<
": Null: NYM_ID passed in!\n";
3097 otErr << __FUNCTION__
3098 <<
": nIndex is out of bounds (it's in the negative!)\n";
3103 if (
nullptr == pNym)
return "";
3106 if (
nullptr != pMessage) {
3119 const int32_t& nIndex)
const
3121 if (NYM_ID.empty()) {
3122 otErr << __FUNCTION__ <<
": Null: NYM_ID passed in!\n";
3126 otErr << __FUNCTION__
3127 <<
": nIndex is out of bounds (it's in the negative!)\n";
3132 if (
nullptr == pNym)
return false;
3141 otErr << __FUNCTION__ <<
": Error saving Nym: " << NYM_ID <<
"\n";
3166 const int32_t& nIndex)
const
3168 if (NYM_ID.empty()) {
3169 otErr << __FUNCTION__ <<
": Null: NYM_ID passed in!\n";
3173 otErr << __FUNCTION__
3174 <<
": nIndex is out of bounds (it's in the negative!)\n";
3179 if (
nullptr == pNym)
return false;
3181 if (
nullptr != pMessage) {
3191 if (
nullptr != pSenderNym) {
3210 if (NYM_ID.empty()) {
3211 otErr << __FUNCTION__ <<
": Null: NYM_ID passed in!\n";
3216 if (
nullptr == pNym)
return -1;
3223 const std::string& NYM_ID,
const int32_t& nIndex)
const
3225 if (NYM_ID.empty()) {
3226 otErr << __FUNCTION__ <<
": Null: NYM_ID passed in!\n";
3230 otErr << __FUNCTION__
3231 <<
": nIndex is out of bounds (it's in the negative!)\n";
3236 if (
nullptr == pNym)
return "";
3238 if (
nullptr != pMessage) {
3252 std::string pBuf = strPayment.
Get();
3263 const std::string& NYM_ID,
const int32_t& nIndex)
const
3265 if (NYM_ID.empty()) {
3266 otErr << __FUNCTION__ <<
": Null: NYM_ID passed in!\n";
3270 otErr << __FUNCTION__
3271 <<
": nIndex is out of bounds (it's in the negative!)\n";
3276 if (
nullptr == pNym)
return "";
3278 if (
nullptr != pMessage) {
3293 const std::string& NYM_ID,
const int32_t& nIndex)
const
3295 if (NYM_ID.empty()) {
3296 otErr << __FUNCTION__ <<
": Null: NYM_ID passed in!\n";
3300 otErr << __FUNCTION__
3301 <<
": nIndex is out of bounds (it's in the negative!)\n";
3306 if (
nullptr == pNym)
return "";
3309 if (
nullptr != pMessage) {
3316 if (1 >= bServerIdLength) {
3317 otErr << __FUNCTION__ <<
": m_strServerID Length is 1 or less!\n";
3328 const int32_t& nIndex)
const
3330 if (NYM_ID.empty()) {
3331 otErr << __FUNCTION__ <<
": Null: NYM_ID passed in!\n";
3335 otErr << __FUNCTION__
3336 <<
": nIndex is out of bounds (it's in the negative!)\n";
3342 if (
nullptr == pNym)
return false;
3351 otErr << __FUNCTION__ <<
": Error saving Nym: " << NYM_ID <<
"\n";
3376 const int32_t& nIndex)
const
3378 if (NYM_ID.empty()) {
3379 otErr << __FUNCTION__ <<
": Null: NYM_ID passed in!\n";
3383 otErr << __FUNCTION__
3384 <<
": nIndex is out of bounds (it's in the negative!)\n";
3389 if (
nullptr == pNym)
return false;
3391 if (
nullptr != pMessage) {
3401 if (
nullptr != pSenderNym) {
3424 if (THE_INSTRUMENT.empty()) {
3425 otErr << __FUNCTION__ <<
": Null: THE_INSTRUMENT passed in!\n";
3428 const OTString strInstrument(THE_INSTRUMENT);
3432 otOut << __FUNCTION__ <<
": Unable to parse instrument:\n\n"
3433 << strInstrument <<
"\n\n";
3438 otOut << __FUNCTION__ <<
": Unable to load instrument:\n\n"
3439 << strInstrument <<
"\n\n";
3447 int64_t lOutput = 0;
3452 const std::string& THE_INSTRUMENT)
const
3454 if (THE_INSTRUMENT.empty()) {
3455 otErr << __FUNCTION__ <<
": Null: THE_INSTRUMENT passed in!\n";
3458 const OTString strInstrument(THE_INSTRUMENT);
3462 otOut << __FUNCTION__ <<
": Unable to parse instrument:\n\n"
3463 << strInstrument <<
"\n\n";
3468 otOut << __FUNCTION__ <<
": Unable to load instrument:\n\n"
3469 << strInstrument <<
"\n\n";
3477 int64_t lOutput = 0;
3480 return bGotData ? lOutput : -1;
3484 const std::string& THE_INSTRUMENT)
const
3486 if (THE_INSTRUMENT.empty()) {
3487 otErr << __FUNCTION__ <<
": Null: THE_INSTRUMENT passed in!\n";
3490 const OTString strInstrument(THE_INSTRUMENT);
3494 otOut << __FUNCTION__ <<
": Unable to parse instrument:\n\n"
3495 << strInstrument <<
"\n\n";
3500 otOut << __FUNCTION__ <<
": Unable to load instrument:\n\n"
3501 << strInstrument <<
"\n\n";
3512 const bool& bGotData = thePayment.
GetValidFrom(tOutput);
3518 const std::string& THE_INSTRUMENT)
const
3520 if (THE_INSTRUMENT.empty()) {
3521 otErr << __FUNCTION__ <<
": Null: THE_INSTRUMENT passed in!\n";
3524 const OTString strInstrument(THE_INSTRUMENT);
3528 otOut << __FUNCTION__ <<
": Unable to parse instrument:\n\n"
3529 << strInstrument <<
"\n\n";
3534 otOut << __FUNCTION__ <<
": Unable to load instrument:\n\n"
3535 << strInstrument <<
"\n\n";
3546 const bool& bGotData = thePayment.
GetValidTo(tOutput);
3552 const std::string& THE_INSTRUMENT)
const
3554 if (THE_INSTRUMENT.empty()) {
3555 otErr << __FUNCTION__ <<
": Null: THE_INSTRUMENT passed in!\n";
3558 const OTString strInstrument(THE_INSTRUMENT);
3562 otOut << __FUNCTION__ <<
": Unable to parse instrument:\n\n"
3563 << strInstrument <<
"\n\n";
3568 otOut << __FUNCTION__ <<
": Unable to load instrument:\n\n"
3569 << strInstrument <<
"\n\n";
3579 if (strOutput.Exists()) {
3580 std::string pBuf = strOutput.
Get();
3589 const std::string& THE_INSTRUMENT)
const
3591 if (THE_INSTRUMENT.empty()) {
3592 otErr << __FUNCTION__ <<
": Null: THE_INSTRUMENT passed in!\n";
3595 const OTString strInstrument(THE_INSTRUMENT);
3599 otOut << __FUNCTION__ <<
": Unable to parse instrument:\n\n"
3600 << strInstrument <<
"\n\n";
3605 otOut << __FUNCTION__ <<
": Unable to load instrument:\n\n"
3606 << strInstrument <<
"\n\n";
3616 const bool& bGotData = thePayment.
GetMemo(strOutput);
3619 std::string pBuf = strOutput.
Get();
3627 const std::string& THE_INSTRUMENT)
const
3629 if (THE_INSTRUMENT.empty()) {
3630 otErr << __FUNCTION__ <<
": Null: THE_INSTRUMENT passed in!\n";
3633 const OTString strInstrument(THE_INSTRUMENT);
3637 otOut << __FUNCTION__ <<
": Unable to parse instrument:\n\n"
3638 << strInstrument <<
"\n\n";
3643 otOut << __FUNCTION__ <<
": Unable to load instrument:\n\n"
3644 << strInstrument <<
"\n\n";
3654 const bool& bGotData = thePayment.
GetServerID(theOutput);
3657 const OTString strOutput(theOutput);
3658 std::string pBuf = strOutput.
Get();
3666 const std::string& THE_INSTRUMENT)
const
3668 if (THE_INSTRUMENT.empty()) {
3669 otErr << __FUNCTION__ <<
": Null: THE_INSTRUMENT passed in!\n";
3672 const OTString strInstrument(THE_INSTRUMENT);
3676 otOut << __FUNCTION__ <<
": Unable to parse instrument:\n\n"
3677 << strInstrument <<
"\n\n";
3682 otOut << __FUNCTION__ <<
": Unable to load instrument:\n\n"
3683 << strInstrument <<
"\n\n";
3696 const OTString strOutput(theOutput);
3697 std::string pBuf = strOutput.
Get();
3705 const std::string& THE_INSTRUMENT)
const
3707 if (THE_INSTRUMENT.empty()) {
3708 otErr << __FUNCTION__ <<
": Null: THE_INSTRUMENT passed in!\n";
3711 const OTString strInstrument(THE_INSTRUMENT);
3715 otOut << __FUNCTION__ <<
": Unable to parse instrument:\n\n"
3716 << strInstrument <<
"\n\n";
3721 otOut << __FUNCTION__ <<
": Unable to load instrument:\n\n"
3722 << strInstrument <<
"\n\n";
3735 const OTString strOutput(theOutput);
3736 std::string pBuf = strOutput.
Get();
3744 const std::string& THE_INSTRUMENT)
const
3746 if (THE_INSTRUMENT.empty()) {
3747 otErr << __FUNCTION__ <<
": Null: THE_INSTRUMENT passed in!\n";
3750 const OTString strInstrument(THE_INSTRUMENT);
3754 otOut << __FUNCTION__ <<
": Unable to parse instrument:\n\n"
3755 << strInstrument <<
"\n\n";
3760 otOut << __FUNCTION__ <<
": Unable to load instrument:\n\n"
3761 << strInstrument <<
"\n\n";
3774 const OTString strOutput(theOutput);
3775 std::string pBuf = strOutput.
Get();
3783 const std::string& THE_INSTRUMENT)
const
3785 if (THE_INSTRUMENT.empty()) {
3786 otErr << __FUNCTION__ <<
": Null: THE_INSTRUMENT passed in!\n";
3789 const OTString strInstrument(THE_INSTRUMENT);
3793 otOut << __FUNCTION__ <<
": Unable to parse instrument:\n\n"
3794 << strInstrument <<
"\n\n";
3799 otOut << __FUNCTION__ <<
": Unable to load instrument:\n\n"
3800 << strInstrument <<
"\n\n";
3813 const OTString strOutput(theOutput);
3814 std::string pBuf = strOutput.
Get();
3822 const std::string& THE_INSTRUMENT)
const
3824 if (THE_INSTRUMENT.empty()) {
3825 otErr << __FUNCTION__ <<
": Null: THE_INSTRUMENT passed in!\n";
3828 const OTString strInstrument(THE_INSTRUMENT);
3832 otOut << __FUNCTION__ <<
": Unable to parse instrument:\n\n"
3833 << strInstrument <<
"\n\n";
3838 otOut << __FUNCTION__ <<
": Unable to load instrument:\n\n"
3839 << strInstrument <<
"\n\n";
3852 const OTString strOutput(theOutput);
3853 std::string pBuf = strOutput.
Get();
3861 const std::string& THE_INSTRUMENT)
const
3863 if (THE_INSTRUMENT.empty()) {
3864 otErr << __FUNCTION__ <<
": Null: THE_INSTRUMENT passed in!\n";
3867 const OTString strInstrument(THE_INSTRUMENT);
3871 otOut << __FUNCTION__ <<
": Unable to parse instrument:\n\n"
3872 << strInstrument <<
"\n\n";
3877 otOut << __FUNCTION__ <<
": Unable to load instrument:\n\n"
3878 << strInstrument <<
"\n\n";
3888 const bool& bGotData =
3892 const OTString strOutput(theOutput);
3893 std::string pBuf = strOutput.
Get();
3901 const std::string& THE_INSTRUMENT)
const
3903 if (THE_INSTRUMENT.empty()) {
3904 otErr << __FUNCTION__ <<
": Null: THE_INSTRUMENT passed in!\n";
3907 const OTString strInstrument(THE_INSTRUMENT);
3911 otOut << __FUNCTION__ <<
": Unable to parse instrument:\n\n"
3912 << strInstrument <<
"\n\n";
3917 otOut << __FUNCTION__ <<
": Unable to load instrument:\n\n"
3918 << strInstrument <<
"\n\n";
3927 const bool& bGotData =
3931 const OTString strOutput(theOutput);
3932 std::string pBuf = strOutput.
Get();
3958 const std::string& SIGNER_NYM_ID,
3959 const std::string& NYM_NEW_NAME)
const
3961 if (NYM_ID.empty()) {
3962 otErr << __FUNCTION__ <<
": Null: NYM_ID passed in!\n";
3965 if (SIGNER_NYM_ID.empty()) {
3966 otErr << __FUNCTION__ <<
": Null: SINGER_NYM_ID passed in!\n";
3969 if (NYM_NEW_NAME.empty()) {
3970 otErr << __FUNCTION__ <<
": Null: NYM_NEW_NAME passed in!\n";
3974 const OTIdentifier theNymID(NYM_ID), theSignerNymID(SIGNER_NYM_ID);
3975 const OTString strNymName(NYM_NEW_NAME);
3977 bool bSuccess =
OTAPI()->
SetNym_Name(theNymID, theSignerNymID, strNymName);
3984 const std::string& STR_NEW_NAME)
const
3986 if (SERVER_ID.empty()) {
3987 otErr << __FUNCTION__ <<
": Null SERVER_ID passed in!\n";
3990 if (STR_NEW_NAME.empty()) {
3991 otErr << __FUNCTION__ <<
": Null STR_NEW_NAME passed in!\n";
3996 const OTString strNewName(STR_NEW_NAME);
4005 const std::string& STR_NEW_NAME)
const
4007 if (ASSET_ID.empty()) {
4008 otErr << __FUNCTION__ <<
": Null: ASSET_ID passed in!\n";
4011 if (STR_NEW_NAME.empty()) {
4012 otErr << __FUNCTION__ <<
": Null: STR_NEW_NAME passed in!\n";
4017 const OTString strNewName(STR_NEW_NAME);
4035 const std::string& NYM_ID)
const
4037 if (SERVER_ID.empty()) {
4038 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
4041 if (NYM_ID.empty()) {
4042 otErr << __FUNCTION__ <<
": Null: NYM_ID passed in!\n";
4049 int32_t nReturnValue = 0;
4052 if (
nullptr != pNym)
4057 return nReturnValue;
4064 otErr << __FUNCTION__
4065 <<
": nIndex is out of bounds (it's in the negative!)\n";
4076 std::string pBuf = strID.
Get();
4086 if (THE_ID.empty()) {
4087 otErr << __FUNCTION__ <<
": Null: THE_ID passed in!\n";
4093 if (
nullptr == pServer)
return "";
4096 std::string pBuf = strName.
Get();
4105 otErr << __FUNCTION__
4106 <<
": nIndex is out of bounds (it's in the negative!)\n";
4117 std::string pBuf = strID.
Get();
4127 if (THE_ID.empty()) {
4128 otErr << __FUNCTION__ <<
": Null: THE_ID passed in!\n";
4134 if (
nullptr == pContract)
return "";
4137 std::string pBuf = strName.
Get();
4145 if (THE_ID.empty()) {
4146 otErr << __FUNCTION__ <<
": Null: THE_ID passed in!\n";
4152 if (
nullptr == pContract)
return "";
4155 std::string pBuf = strTLA.
Get();
4164 otErr << __FUNCTION__
4165 <<
": nIndex is out of bounds (it's in the negative!)\n";
4177 std::string pBuf = strID.
Get();
4187 if (THE_ID.empty()) {
4188 otErr << __FUNCTION__ <<
": Null: THE_ID passed in!\n";
4194 std::string strFunc =
"OTAPI_Exec::GetAccountWallet_Name";
4196 if (
nullptr == pAccount)
return "";
4199 std::string pBuf = strName.
Get();
4205 const std::string& ACCOUNT_ID)
const
4210 if (ACCOUNT_ID.empty()) {
4211 otErr << __FUNCTION__ <<
": Null: ACCOUNT_ID passed in!\n";
4217 OTAccount* pAccount = OTAPI()->GetAccount(theID, __FUNCTION__);
4218 if (
nullptr == pAccount)
return "";
4221 const bool& bGotHash = pAccount->
GetInboxHash(theOutput);
4225 if (bGotHash) theOutput.
GetString(strOutput);
4227 std::string pBuf = strOutput.
Get();
4233 const std::string& ACCOUNT_ID)
const
4238 if (ACCOUNT_ID.empty()) {
4239 otErr << __FUNCTION__ <<
": Null: ACCOUNT_ID passed in!\n";
4245 OTAccount* pAccount = OTAPI()->GetAccount(theID, __FUNCTION__);
4246 if (
nullptr == pAccount)
return "";
4253 if (bGotHash) theOutput.
GetString(strOutput);
4255 std::string pBuf = strOutput.
Get();
4288 const bool& bLineBreaks)
const
4293 if (strPlaintext.empty()) {
4294 otErr << __FUNCTION__ <<
": Null: strPlaintext passed in!\n";
4298 const OTString otstrPlaintext(strPlaintext);
4301 bool bEncoded = OTAPI()->Encode(otstrPlaintext, strOutput,
4302 (
true == bLineBreaks) ?
true :
false);
4304 if (!bEncoded)
return "";
4306 std::string pBuf = strOutput.
Get();
4325 const bool& bLineBreaks)
const
4327 if (strEncoded.empty()) {
4331 const OTString otstrEncoded(strEncoded);
4334 bool bDecoded =
OTAPI()->
Decode(otstrEncoded, strOutput,
4335 (
true == bLineBreaks) ?
true :
false);
4337 if (!bDecoded)
return "";
4339 std::string pBuf = strOutput.
Get();
4363 const std::string& strPlaintext)
const
4365 if (RECIPIENT_NYM_ID.empty()) {
4366 otErr << __FUNCTION__ <<
": Null: RECIPIENT_NYM_ID passed in!\n";
4369 if (strPlaintext.empty()) {
4370 otErr << __FUNCTION__ <<
": Null: strPlaintext passed in!\n";
4373 const OTString otstrPlaintext(strPlaintext);
4374 const OTIdentifier theRecipientNymID(RECIPIENT_NYM_ID);
4378 OTAPI()->
Encrypt(theRecipientNymID, otstrPlaintext, strOutput);
4380 if (!bEncrypted || !strOutput.
Exists())
return "";
4382 std::string pBuf = strOutput.
Get();
4412 const std::string& strCiphertext)
const
4414 if (RECIPIENT_NYM_ID.empty()) {
4415 otErr << __FUNCTION__ <<
": Null: RECIPIENT_NYM_ID passed in!\n";
4418 if (strCiphertext.empty()) {
4419 otErr << __FUNCTION__ <<
": Null: strCiphertext passed in!\n";
4422 const OTString otstrCiphertext(strCiphertext);
4423 const OTIdentifier theRecipientNymID(RECIPIENT_NYM_ID);
4427 OTAPI()->
Decrypt(theRecipientNymID, otstrCiphertext, strOutput);
4429 if (!bDecrypted || !strOutput.
Exists())
return "";
4431 std::string pBuf = strOutput.
Get();
4444 std::string strDisplay =
"OTAPI: Creating a new symmetric key.";
4445 const OTString otstrDisplay(strDisplay);
4447 strOutput, &otstrDisplay);
4449 if (!bSuccess)
return "";
4451 std::string pBuf = strOutput.
Get();
4466 const std::string& PLAINTEXT)
const
4468 if (SYMMETRIC_KEY.empty()) {
4469 otErr << __FUNCTION__ <<
": Null: SYMMETRIC_KEY passed in!\n";
4472 if (PLAINTEXT.empty()) {
4473 otErr << __FUNCTION__ <<
": Null: PLAINTEXT passed in!\n";
4476 const OTString strKey(SYMMETRIC_KEY);
4477 const OTString strPlaintext(PLAINTEXT);
4479 std::string strDisplay =
"OTAPI: Password-protecting a plaintext.";
4480 const OTString otstrDisplay(strDisplay);
4482 strKey, strPlaintext, strOutput,
4485 if (!bSuccess)
return "";
4487 std::string pBuf = strOutput.
Get();
4495 const std::string& SYMMETRIC_KEY,
4496 const std::string& CIPHERTEXT_ENVELOPE)
const
4498 if (SYMMETRIC_KEY.empty()) {
4499 otErr << __FUNCTION__ <<
": Null: SYMMETRIC_KEY passed in!\n";
4502 if (CIPHERTEXT_ENVELOPE.empty()) {
4503 otErr << __FUNCTION__ <<
": Null: CIPHERTEXT_ENVELOPE passed in!\n";
4506 const OTString strKey(SYMMETRIC_KEY);
4507 OTString strCiphertext(CIPHERTEXT_ENVELOPE);
4509 std::string strDisplay =
4510 "OTAPI: Decrypting a password-protected ciphertext.";
4511 const OTString otstrDisplay(strDisplay);
4513 strKey, strCiphertext, strOutput, &otstrDisplay);
4515 if (!bSuccess)
return "";
4517 std::string pBuf = strOutput.
Get();
4540 const std::string& THE_CONTRACT)
const
4543 if (!bIsInitialized) {
4544 otErr << __FUNCTION__
4545 <<
": Not initialized; call OT_API::Init first.\n";
4549 if (SIGNER_NYM_ID.empty()) {
4550 otErr << __FUNCTION__ <<
": Null: SIGNER_NYM_ID passed in!\n";
4553 if (THE_CONTRACT.empty()) {
4554 otErr << __FUNCTION__ <<
": Null: THE_CONTRACT passed in!\n";
4558 const OTString strContract(THE_CONTRACT);
4562 const bool& bSigned =
4565 if (!bSigned || !strOutput.
Exists())
return "";
4567 std::string pBuf = strOutput.
Get();
4583 const std::string& THE_INPUT,
4584 const std::string& CONTRACT_TYPE)
const
4587 if (!bIsInitialized) {
4588 otErr << __FUNCTION__
4589 <<
": Not initialized; call OT_API::Init first.\n";
4593 if (SIGNER_NYM_ID.empty()) {
4594 otErr << __FUNCTION__ <<
": Null: SIGNER_NYM_ID passed in!\n";
4597 if (THE_INPUT.empty()) {
4598 otErr << __FUNCTION__ <<
": Null: THE_INPUT passed in!\n";
4601 if (CONTRACT_TYPE.empty()) {
4602 otErr << __FUNCTION__ <<
": Null: CONTRACT_TYPE passed in!\n";
4606 const OTString strContract(THE_INPUT);
4607 const OTString strContractType(CONTRACT_TYPE);
4611 const bool& bSigned =
OTAPI()->
FlatSign(theSignerNymID, strContract,
4612 strContractType, strOutput);
4614 if (!bSigned || !strOutput.
Exists())
return "";
4616 std::string pBuf = strOutput.
Get();
4640 const std::string& THE_CONTRACT)
const
4643 if (!bIsInitialized) {
4644 otErr << __FUNCTION__
4645 <<
": Not initialized; call OT_API::Init first.\n";
4649 if (SIGNER_NYM_ID.empty()) {
4650 otErr << __FUNCTION__ <<
": Null: SIGNER_NYM_ID passed in!\n";
4653 if (THE_CONTRACT.empty()) {
4654 otErr << __FUNCTION__ <<
": Null: THE_CONTRACT passed in!\n";
4658 const OTString strContract(THE_CONTRACT);
4662 const bool& bSigned =
4665 if (!bSigned || !strOutput.
Exists())
return "";
4667 std::string pBuf = strOutput.
Get();
4677 const std::string& THE_CONTRACT)
const
4679 if (SIGNER_NYM_ID.empty()) {
4680 otErr << __FUNCTION__ <<
": Null: SIGNER_NYM_ID passed in!\n";
4683 if (THE_CONTRACT.empty()) {
4684 otErr << __FUNCTION__ <<
": Null: THE_CONTRACT passed in!\n";
4687 const OTString strContract(THE_CONTRACT);
4690 strContract, theNymID);
4692 return bVerified ?
true :
false;
4704 const std::string& THE_CONTRACT,
const std::string& SIGNER_ID)
const
4706 if (THE_CONTRACT.empty()) {
4707 otErr << __FUNCTION__ <<
": Null: THE_CONTRACT passed in!\n";
4710 if (SIGNER_ID.empty()) {
4711 otErr << __FUNCTION__ <<
": Null: SIGNER_ID passed in!\n";
4715 const OTString strContract(THE_CONTRACT);
4722 otOut << __FUNCTION__ <<
": Failure: "
4723 "OTAPI()->VerifyAndRetrieveXMLContents() "
4724 "returned false.\n";
4727 std::string pBuf = strOutput.
Get();
4739 const std::string& NYM_ID,
4740 const std::string& ACCT_ID)
const
4742 if (SERVER_ID.empty()) {
4743 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
4746 if (NYM_ID.empty()) {
4747 otErr << __FUNCTION__ <<
": Null: NYM_ID passed in!\n";
4750 if (ACCT_ID.empty()) {
4751 otErr << __FUNCTION__ <<
": Null: ACCT_ID passed in!\n";
4755 const OTIdentifier theServerID(SERVER_ID), theNymID(NYM_ID),
4757 const bool& bVerified =
4759 return bVerified ?
true :
false;
4767 const std::string& SIGNER_NYM_ID,
4768 const std::string& ACCT_NEW_NAME)
const
4770 if (ACCT_ID.empty()) {
4771 otErr << __FUNCTION__ <<
": Null: ACCT_ID passed in!\n";
4774 if (SIGNER_NYM_ID.empty()) {
4775 otErr << __FUNCTION__ <<
": Null: SIGNER_NYM_ID passed in!\n";
4778 if (ACCT_NEW_NAME.empty()) {
4779 otErr << __FUNCTION__ <<
": Null: ACCT_NEW_NAME passed in!\n";
4783 OTIdentifier theAcctID(ACCT_ID), theSignerNymID(SIGNER_NYM_ID);
4784 OTString strAcctNewName(ACCT_NEW_NAME);
4789 return bSuccess ?
true :
false;
4795 if (THE_ID.empty()) {
4796 otErr << __FUNCTION__ <<
": Null: THE_ID passed in!\n";
4808 if (THE_ID.empty()) {
4809 otErr << __FUNCTION__ <<
": Null: THE_ID passed in!\n";
4815 if (
nullptr == pAccount)
return "";
4824 const std::string& THE_ID)
const
4826 if (THE_ID.empty()) {
4827 otErr << __FUNCTION__ <<
": Null: THE_ID passed in!\n";
4833 if (
nullptr == pAccount)
return "";
4836 OTString strAssetTypeID(theAssetID);
4838 otWarn << __FUNCTION__ <<
": Returning asset type " << strAssetTypeID
4839 <<
" for account " << THE_ID <<
"\n";
4841 std::string pBuf = strAssetTypeID.Get();
4849 const std::string& THE_ID)
const
4851 if (THE_ID.empty()) {
4852 otErr << __FUNCTION__ <<
": Null: THE_ID passed in!\n";
4858 if (
nullptr == pAccount)
return "";
4862 std::string pBuf = strServerID.Get();
4871 if (THE_ID.empty()) {
4872 otErr << __FUNCTION__ <<
": Null: THE_ID passed in!\n";
4879 if (
nullptr == pAccount)
return "";
4883 std::string pBuf = strUserID.Get();
4917 const std::string& SERVER_ID,
const int64_t& CHEQUE_AMOUNT,
4919 const std::string& SENDER_ACCT_ID,
const std::string& SENDER_USER_ID,
4920 const std::string& CHEQUE_MEMO,
const std::string& RECIPIENT_USER_ID)
const
4922 if (SERVER_ID.empty()) {
4923 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
4926 if (0 == CHEQUE_AMOUNT) {
4927 otErr << __FUNCTION__ <<
": Null: CHEQUE_AMOUNT passed in!\n";
4931 otErr << __FUNCTION__ <<
": Null: VALID_FROM passed in!\n";
4935 otErr << __FUNCTION__ <<
": Null: VALID_TO passed in!\n";
4938 if (SENDER_ACCT_ID.empty()) {
4939 otErr << __FUNCTION__ <<
": Null: SENDER_ACCT_ID passed in!\n";
4942 if (SENDER_USER_ID.empty()) {
4943 otErr << __FUNCTION__ <<
": Null: SENDER_USER_ID passed in!\n";
4953 const int64_t lAmount = CHEQUE_AMOUNT;
4955 time_To = static_cast<time64_t>(VALID_TO);
4961 bool bHasRecipient = !RECIPIENT_USER_ID.empty();
4962 if (bHasRecipient) theRecipientUserID.
SetString(RECIPIENT_USER_ID);
4965 if (!CHEQUE_MEMO.empty()) strMemo.
Set(CHEQUE_MEMO);
4968 theServerID, static_cast<int64_t>(lAmount), time_From, time_To,
4969 theSenderAcctID, theSenderUserID, strMemo,
4970 bHasRecipient ? &(theRecipientUserID) :
nullptr));
4972 if (
nullptr == pCheque) {
4973 otErr << __FUNCTION__ <<
": OT_API::WriteCheque failed.\n";
4981 std::string pBuf = strCheque.
Get();
4987 const std::string& USER_ID,
4988 const std::string& ACCT_ID,
4989 const std::string& THE_CHEQUE)
const
4991 if (SERVER_ID.empty()) {
4992 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
4995 if (USER_ID.empty()) {
4996 otErr << __FUNCTION__ <<
": Null: USER_ID passed in!\n";
4999 if (ACCT_ID.empty()) {
5000 otErr << __FUNCTION__ <<
": Null: ACCT_ID passed in!\n";
5003 if (THE_CHEQUE.empty()) {
5004 otErr << __FUNCTION__ <<
": Null: THE_CHEQUE passed in!\n";
5008 OTIdentifier theServerID(SERVER_ID), theUserID(USER_ID), theAcctID(ACCT_ID);
5011 const bool bDiscarded =
5014 return (bDiscarded ?
true :
false);
5040 const std::string& SERVER_ID,
5047 const std::string& SENDER_ACCT_ID,
5048 const std::string& SENDER_USER_ID,
5050 const std::string& PLAN_CONSIDERATION,
5051 const std::string& RECIPIENT_ACCT_ID,
5052 const std::string& RECIPIENT_USER_ID,
5054 const int64_t& INITIAL_PAYMENT_AMOUNT,
5055 const time64_t& INITIAL_PAYMENT_DELAY,
5057 const int64_t& PAYMENT_PLAN_AMOUNT,
5058 const time64_t& PAYMENT_PLAN_DELAY,
5060 const time64_t& PAYMENT_PLAN_PERIOD,
5062 const time64_t& PAYMENT_PLAN_LENGTH,
5064 const int32_t& PAYMENT_PLAN_MAX_PAYMENTS
5068 if (SERVER_ID.empty()) {
5069 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
5073 otErr << __FUNCTION__ <<
": Negative: VALID_FROM passed in!\n";
5077 otErr << __FUNCTION__ <<
": Negative: VALID_TO passed in!\n";
5080 if (SENDER_ACCT_ID.empty()) {
5081 otErr << __FUNCTION__ <<
": Null: SENDER_ACCT_ID passed in!\n";
5084 if (SENDER_USER_ID.empty()) {
5085 otErr << __FUNCTION__ <<
": Null: SENDER_USER_ID passed in!\n";
5088 if (PLAN_CONSIDERATION.empty()) {
5089 otErr << __FUNCTION__ <<
": Null: PLAN_CONSIDERATION passed in!\n";
5092 if (RECIPIENT_ACCT_ID.empty()) {
5093 otErr << __FUNCTION__ <<
": Null: RECIPIENT_ACCT_ID passed in!\n";
5096 if (RECIPIENT_USER_ID.empty()) {
5097 otErr << __FUNCTION__ <<
": Null: RECIPIENT_USER_ID passed in!\n";
5100 if (0 > INITIAL_PAYMENT_AMOUNT) {
5101 otErr << __FUNCTION__
5102 <<
": Negative: INITIAL_PAYMENT_AMOUNT passed in!\n";
5106 otErr << __FUNCTION__
5107 <<
": Negative: INITIAL_PAYMENT_DELAY passed in!\n";
5110 if (0 > PAYMENT_PLAN_AMOUNT) {
5111 otErr << __FUNCTION__ <<
": Negative: PAYMENT_PLAN_AMOUNT passed in!\n";
5115 otErr << __FUNCTION__ <<
": Negative: PAYMENT_PLAN_DELAY passed in!\n";
5119 otErr << __FUNCTION__ <<
": Negative: PAYMENT_PLAN_PERIOD passed in!\n";
5123 otErr << __FUNCTION__ <<
": Negative: PAYMENT_PLAN_LENGTH passed in!\n";
5126 if (0 > PAYMENT_PLAN_MAX_PAYMENTS) {
5127 otErr << __FUNCTION__
5128 <<
": Negative: PAYMENT_PLAN_MAX_PAYMENTS passed in!\n";
5135 PLAN_CONSIDERATION.empty() ?
"(Consideration for the agreement between "
5136 "the parties is meant to be recorded "
5138 : PLAN_CONSIDERATION,
5141 static_cast<int64_t
>(INITIAL_PAYMENT_AMOUNT), INITIAL_PAYMENT_DELAY,
5142 static_cast<int64_t>(PAYMENT_PLAN_AMOUNT), PAYMENT_PLAN_DELAY,
5143 PAYMENT_PLAN_PERIOD, PAYMENT_PLAN_LENGTH,
5144 static_cast<int32_t
>(PAYMENT_PLAN_MAX_PAYMENTS)));
5145 if (
nullptr == pPlan) {
5146 otErr << __FUNCTION__
5147 <<
": failed in OTAPI_Exec::ProposePaymentPlan.\n";
5153 std::string pBuf = strOutput.
Get();
5166 const std::string& SERVER_ID,
5167 const std::string& DATE_RANGE,
5170 const std::string& SENDER_ACCT_ID,
5171 const std::string& SENDER_USER_ID,
5173 const std::string& PLAN_CONSIDERATION,
5174 const std::string& RECIPIENT_ACCT_ID,
5175 const std::string& RECIPIENT_USER_ID,
5177 const std::string& INITIAL_PAYMENT,
5181 const std::string& PAYMENT_PLAN,
5184 const std::string& PLAN_EXPIRY
5190 if (SERVER_ID.empty()) {
5191 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
5194 if (SENDER_ACCT_ID.empty()) {
5195 otErr << __FUNCTION__ <<
": Null: SENDER_ACCT_ID passed in!\n";
5198 if (SENDER_USER_ID.empty()) {
5199 otErr << __FUNCTION__ <<
": Null: SENDER_USER_ID passed in!\n";
5202 if (PLAN_CONSIDERATION.empty()) {
5203 otErr << __FUNCTION__ <<
": Null: PLAN_CONSIDERATION passed in!\n";
5206 if (RECIPIENT_ACCT_ID.empty()) {
5207 otErr << __FUNCTION__ <<
": Null: RECIPIENT_ACCT_ID passed in!\n";
5210 if (RECIPIENT_USER_ID.empty()) {
5211 otErr << __FUNCTION__ <<
": Null: RECIPIENT_USER_ID passed in!\n";
5216 int64_t INITIAL_PAYMENT_AMOUNT = 0;
5218 int64_t PAYMENT_PLAN_AMOUNT = 0;
5222 int32_t PAYMENT_PLAN_MAX_PAYMENTS = 0;
5223 if (!DATE_RANGE.empty()) {
5225 const OTString otstrNumList(DATE_RANGE);
5226 theList.Add(otstrNumList);
5228 if (theList.
Count() > 0) {
5234 if (theList.
Count() > 0) {
5240 if (!INITIAL_PAYMENT.empty()) {
5242 const OTString otstrNumList(INITIAL_PAYMENT);
5243 theList.Add(otstrNumList);
5245 if (theList.
Count() > 0) {
5247 if (theList.
Peek(lVal))
5248 INITIAL_PAYMENT_AMOUNT = static_cast<int64_t>(lVal);
5252 if (theList.
Count() > 0) {
5254 if (theList.
Peek(lVal))
5259 if (!PAYMENT_PLAN.empty()) {
5261 const OTString otstrNumList(PAYMENT_PLAN);
5262 theList.Add(otstrNumList);
5264 if (theList.
Count() > 0) {
5266 if (theList.
Peek(lVal))
5267 PAYMENT_PLAN_AMOUNT = static_cast<int64_t>(lVal);
5271 if (theList.
Count() > 0) {
5273 if (theList.
Peek(lVal))
5278 if (theList.
Count() > 0) {
5280 if (theList.
Peek(lVal))
5285 if (!PLAN_EXPIRY.empty()) {
5287 const OTString otstrNumList(PLAN_EXPIRY);
5288 theList.Add(otstrNumList);
5290 if (theList.
Count() > 0) {
5292 if (theList.
Peek(lVal))
5297 if (theList.
Count() > 0) {
5299 if (theList.
Peek(lVal))
5300 PAYMENT_PLAN_MAX_PAYMENTS = static_cast<int32_t>(lVal);
5305 SERVER_ID, VALID_FROM, VALID_TO, SENDER_ACCT_ID, SENDER_USER_ID,
5306 PLAN_CONSIDERATION, RECIPIENT_ACCT_ID, RECIPIENT_USER_ID,
5307 INITIAL_PAYMENT_AMOUNT, INITIAL_PAYMENT_DELAY, PAYMENT_PLAN_AMOUNT,
5308 PAYMENT_PLAN_DELAY, PAYMENT_PLAN_PERIOD, PAYMENT_PLAN_LENGTH,
5309 PAYMENT_PLAN_MAX_PAYMENTS);
5317 const std::string& SERVER_ID,
const std::string& SENDER_USER_ID,
5318 const std::string& SENDER_ACCT_ID,
const std::string& RECIPIENT_USER_ID,
5319 const std::string& PAYMENT_PLAN)
const
5321 if (SERVER_ID.empty()) {
5322 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
5325 if (SENDER_ACCT_ID.empty()) {
5326 otErr << __FUNCTION__ <<
": Null: SENDER_ACCT_ID passed in!\n";
5329 if (SENDER_USER_ID.empty()) {
5330 otErr << __FUNCTION__ <<
": Null: SENDER_USER_ID passed in!\n";
5333 if (RECIPIENT_USER_ID.empty()) {
5334 otErr << __FUNCTION__ <<
": Null: RECIPIENT_USER_ID passed in!\n";
5337 if (PAYMENT_PLAN.empty()) {
5338 otErr << __FUNCTION__ <<
": Null: PAYMENT_PLAN passed in!\n";
5345 const OTIdentifier theRecipientUserID(RECIPIENT_USER_ID);
5348 const OTString strPlan(PAYMENT_PLAN);
5352 otOut << __FUNCTION__
5353 <<
": Failure loading payment plan from string.\n";
5358 theRecipientUserID, thePlan);
5360 otOut << __FUNCTION__
5361 <<
": failed in OTAPI_Exec::ConfirmPaymentPlan().\n";
5367 std::string pBuf = strOutput.
Get();
5375 const std::string& SIGNER_NYM_ID,
5382 if (SIGNER_NYM_ID.empty()) {
5383 otErr << __FUNCTION__ <<
": Null: SIGNER_NYM_ID passed in!\n";
5387 otErr << __FUNCTION__ <<
": Negative: VALID_FROM passed in!\n";
5391 otErr << __FUNCTION__ <<
": Negative: VALID_TO passed in!\n";
5399 const bool& bCreated = OTAPI()->Create_SmartContract(
5400 theSignerNymID, tValidFrom,
5403 if (!bCreated || !strOutput.
Exists())
return "";
5406 std::string pBuf = strOutput.
Get();
5418 const std::string& THE_CONTRACT,
5420 const std::string& SIGNER_NYM_ID,
5423 const std::string& BYLAW_NAME)
const
5427 if (THE_CONTRACT.empty()) {
5428 otErr << __FUNCTION__ <<
": Null: THE_CONTRACT passed in!\n";
5431 if (SIGNER_NYM_ID.empty()) {
5432 otErr << __FUNCTION__ <<
": Null: SIGNER_NYM_ID passed in!\n";
5435 if (BYLAW_NAME.empty()) {
5436 otErr << __FUNCTION__ <<
": Null: BYLAW_NAME passed in!\n";
5439 const OTString strContract(THE_CONTRACT), strBylawName(BYLAW_NAME);
5443 const bool& bAdded = OTAPI()->SmartContract_AddBylaw(
5450 if (!bAdded || !strOutput.
Exists())
return "";
5453 std::string pBuf = strOutput.
Get();
5460 const std::string& THE_CONTRACT,
5462 const std::string& SIGNER_NYM_ID,
5465 const std::string& BYLAW_NAME,
5467 const std::string& CLAUSE_NAME,
5469 const std::string& SOURCE_CODE)
const
5472 if (THE_CONTRACT.empty()) {
5473 otErr << __FUNCTION__ <<
": Null: THE_CONTRACT passed in!\n";
5476 if (SIGNER_NYM_ID.empty()) {
5477 otErr << __FUNCTION__ <<
": Null: SIGNER_NYM_ID passed in!\n";
5480 if (BYLAW_NAME.empty()) {
5481 otErr << __FUNCTION__ <<
": Null: BYLAW_NAME passed in!\n";
5484 if (CLAUSE_NAME.empty()) {
5485 otErr << __FUNCTION__ <<
": Null: CLAUSE_NAME passed in!\n";
5488 if (SOURCE_CODE.empty()) {
5489 otErr << __FUNCTION__ <<
": Null: SOURCE_CODE passed in!\n";
5493 const OTString strContract(THE_CONTRACT), strBylawName(BYLAW_NAME),
5494 strClauseName(CLAUSE_NAME), strSourceCode(SOURCE_CODE);
5498 const bool& bAdded = OTAPI()->SmartContract_AddClause(
5508 if (!bAdded || !strOutput.
Exists())
return "";
5511 std::string pBuf = strOutput.
Get();
5518 const std::string& THE_CONTRACT,
5520 const std::string& SIGNER_NYM_ID,
5523 const std::string& BYLAW_NAME,
5525 const std::string& VAR_NAME,
5527 const std::string& VAR_ACCESS,
5528 const std::string& VAR_TYPE,
5529 const std::string& VAR_VALUE)
const
5536 if (THE_CONTRACT.empty()) {
5537 otErr << __FUNCTION__ <<
": Null: THE_CONTRACT passed in!\n";
5540 if (SIGNER_NYM_ID.empty()) {
5541 otErr << __FUNCTION__ <<
": Null: SIGNER_NYM_ID passed in!\n";
5544 if (BYLAW_NAME.empty()) {
5545 otErr << __FUNCTION__ <<
": Null: BYLAW_NAME passed in!\n";
5548 if (VAR_NAME.empty()) {
5549 otErr << __FUNCTION__ <<
": Null: VAR_NAME passed in!\n";
5552 if (VAR_ACCESS.empty()) {
5553 otErr << __FUNCTION__ <<
": Null: VAR_ACCESS passed in!\n";
5556 if (VAR_TYPE.empty()) {
5557 otErr << __FUNCTION__ <<
": Null: VAR_TYPE passed in!\n";
5563 const OTString strContract(THE_CONTRACT), strBylawName(BYLAW_NAME),
5564 strVarName(VAR_NAME), strVarAccess(VAR_ACCESS), strVarType(VAR_TYPE),
5565 strVarValue(VAR_VALUE);
5569 const bool& bAdded = OTAPI()->SmartContract_AddVariable(
5584 if (!bAdded || !strOutput.
Exists())
return "";
5587 std::string pBuf = strOutput.
Get();
5593 const std::string& THE_CONTRACT,
5595 const std::string& SIGNER_NYM_ID,
5598 const std::string& BYLAW_NAME,
5600 const std::string& CALLBACK_NAME,
5603 const std::string& CLAUSE_NAME)
const
5607 if (THE_CONTRACT.empty()) {
5608 otErr << __FUNCTION__ <<
": Null: THE_CONTRACT passed in!\n";
5611 if (SIGNER_NYM_ID.empty()) {
5612 otErr << __FUNCTION__ <<
": Null: SIGNER_NYM_ID passed in!\n";
5615 if (BYLAW_NAME.empty()) {
5616 otErr << __FUNCTION__ <<
": Null: BYLAW_NAME passed in!\n";
5619 if (CALLBACK_NAME.empty()) {
5620 otErr << __FUNCTION__ <<
": Null: CALLBACK_NAME passed in!\n";
5623 if (CLAUSE_NAME.empty()) {
5624 otErr << __FUNCTION__ <<
": Null: CLAUSE_NAME passed in!\n";
5628 const OTString strContract(THE_CONTRACT), strBylawName(BYLAW_NAME),
5629 strCallbackName(CALLBACK_NAME), strClauseName(CLAUSE_NAME);
5633 const bool& bAdded = OTAPI()->SmartContract_AddCallback(
5644 if (!bAdded || !strOutput.
Exists())
return "";
5647 std::string pBuf = strOutput.
Get();
5654 const std::string& THE_CONTRACT,
5656 const std::string& SIGNER_NYM_ID,
5659 const std::string& BYLAW_NAME,
5661 const std::string& HOOK_NAME,
5663 const std::string& CLAUSE_NAME)
const
5669 if (THE_CONTRACT.empty()) {
5670 otErr << __FUNCTION__ <<
": Null: THE_CONTRACT passed in!\n";
5673 if (SIGNER_NYM_ID.empty()) {
5674 otErr << __FUNCTION__ <<
": Null: SIGNER_NYM_ID passed in!\n";
5677 if (BYLAW_NAME.empty()) {
5678 otErr << __FUNCTION__ <<
": Null: BYLAW_NAME passed in!\n";
5681 if (HOOK_NAME.empty()) {
5682 otErr << __FUNCTION__ <<
": Null: HOOK_NAME passed in!\n";
5685 if (CLAUSE_NAME.empty()) {
5686 otErr << __FUNCTION__ <<
": Null: CLAUSE_NAME passed in!\n";
5690 const OTString strContract(THE_CONTRACT), strBylawName(BYLAW_NAME),
5691 strHookName(HOOK_NAME), strClauseName(CLAUSE_NAME);
5695 const bool& bAdded = OTAPI()->SmartContract_AddHook(
5707 if (!bAdded || !strOutput.
Exists())
return "";
5710 std::string pBuf = strOutput.
Get();
5717 const std::string& THE_CONTRACT,
5719 const std::string& SIGNER_NYM_ID,
5722 const std::string& PARTY_NAME,
5724 const std::string& AGENT_NAME)
const
5732 if (THE_CONTRACT.empty()) {
5733 otErr << __FUNCTION__ <<
": Null: THE_CONTRACT passed in!\n";
5736 if (SIGNER_NYM_ID.empty()) {
5737 otErr << __FUNCTION__ <<
": Null: SIGNER_NYM_ID passed in!\n";
5740 if (PARTY_NAME.empty()) {
5741 otErr << __FUNCTION__ <<
": Null: PARTY_NAME passed in!\n";
5744 if (AGENT_NAME.empty()) {
5745 otErr << __FUNCTION__ <<
": Null: AGENT_NAME passed in!\n";
5748 const OTString strContract(THE_CONTRACT), strPartyName(PARTY_NAME),
5749 strAgentName(AGENT_NAME);
5753 const bool& bAdded = OTAPI()->SmartContract_AddParty(
5762 if (!bAdded || !strOutput.
Exists())
return "";
5765 std::string pBuf = strOutput.
Get();
5774 const std::string& THE_CONTRACT,
5776 const std::string& SIGNER_NYM_ID,
5779 const std::string& PARTY_NAME,
5781 const std::string& ACCT_NAME,
5783 const std::string& ASSET_TYPE_ID)
const
5785 if (THE_CONTRACT.empty()) {
5786 otErr << __FUNCTION__ <<
": Null: THE_CONTRACT passed in!\n";
5789 if (SIGNER_NYM_ID.empty()) {
5790 otErr << __FUNCTION__ <<
": Null: SIGNER_NYM_ID passed in!\n";
5793 if (PARTY_NAME.empty()) {
5794 otErr << __FUNCTION__ <<
": Null: PARTY_NAME passed in!\n";
5797 if (ACCT_NAME.empty()) {
5798 otErr << __FUNCTION__ <<
": Null: ACCT_NAME passed in!\n";
5805 const OTString strContract(THE_CONTRACT), strPartyName(PARTY_NAME),
5806 strAcctName(ACCT_NAME), strAssetTypeID(ASSET_TYPE_ID);
5810 const bool& bAdded = OTAPI()->SmartContract_AddAccount(
5819 if (!bAdded || !strOutput.
Exists())
return "";
5822 std::string pBuf = strOutput.
Get();
5844 const std::string& THE_CONTRACT,
5846 const std::string& AGENT_NAME)
const
5848 if (THE_CONTRACT.empty()) {
5849 otErr << __FUNCTION__ <<
": Null: THE_CONTRACT passed in!\n";
5852 if (AGENT_NAME.empty()) {
5853 otErr << __FUNCTION__ <<
": Null: AGENT_NAME passed in!\n";
5856 const OTString strContract(THE_CONTRACT), strAgentName(AGENT_NAME);
5858 const int32_t& nCount =
5871 const std::string& THE_CONTRACT,
const std::string& SIGNER_NYM_ID,
5872 const std::string& PARTY_NAME,
5873 const std::string& ACCT_NAME,
5874 const std::string& AGENT_NAME,
5875 const std::string& ACCT_ID)
const
5878 if (THE_CONTRACT.empty()) {
5879 otErr << __FUNCTION__ <<
": Null: THE_CONTRACT passed in!\n";
5882 if (SIGNER_NYM_ID.empty()) {
5883 otErr << __FUNCTION__ <<
": Null: SIGNER_NYM_ID passed in!\n";
5886 if (PARTY_NAME.empty()) {
5887 otErr << __FUNCTION__ <<
": Null: PARTY_NAME passed in!\n";
5890 if (ACCT_NAME.empty()) {
5891 otErr << __FUNCTION__ <<
": Null: ACCT_NAME passed in!\n";
5894 if (AGENT_NAME.empty()) {
5895 otErr << __FUNCTION__ <<
": Null: AGENT_NAME passed in!\n";
5898 if (ACCT_ID.empty()) {
5899 otErr << __FUNCTION__ <<
": Null: ACCT_ID passed in!\n";
5902 const OTString strContract(THE_CONTRACT), strPartyName(PARTY_NAME);
5903 const OTString strAccountID(ACCT_ID), strAcctName(ACCT_NAME),
5904 strAgentName(AGENT_NAME);
5905 const OTIdentifier theSignerNymID(SIGNER_NYM_ID), theAcctID(strAccountID);
5908 const bool& bConfirmed = OTAPI()->SmartContract_ConfirmAccount(
5909 strContract, theSignerNymID, strPartyName, strAcctName, strAgentName,
5910 strAccountID, strOutput);
5911 if (!bConfirmed || !strOutput.
Exists())
return "";
5914 std::string pBuf = strOutput.
Get();
5925 const std::string& THE_CONTRACT,
5927 const std::string& PARTY_NAME,
5929 const std::string& NYM_ID)
const
5933 if (THE_CONTRACT.empty()) {
5934 otErr << __FUNCTION__ <<
": Null: THE_CONTRACT passed in!\n";
5937 if (PARTY_NAME.empty()) {
5938 otErr << __FUNCTION__ <<
": Null: PARTY_NAME passed in!\n";
5941 if (NYM_ID.empty()) {
5942 otErr << __FUNCTION__ <<
": Null: NYM_ID passed in!\n";
5946 const OTString strContract(THE_CONTRACT), strPartyName(PARTY_NAME);
5949 const bool& bConfirmed = OTAPI()->SmartContract_ConfirmParty(
5956 if (!bConfirmed || !strOutput.
Exists())
return "";
5959 std::string pBuf = strOutput.
Get();
5964 const std::string& THE_CONTRACT)
const
5966 if (THE_CONTRACT.empty()) {
5967 otErr << __FUNCTION__ <<
": Null: THE_CONTRACT passed in!\n";
5970 OTString strContract(THE_CONTRACT);
5971 std::unique_ptr<OTScriptable> pScriptable(
5973 if (
nullptr == pScriptable) {
5974 otOut << __FUNCTION__
5975 <<
": Failed trying to load smart contract from string : \n\n"
5976 << strContract <<
"\n\n";
5979 const bool bConfirmed =
5981 const bool bVerified =
5987 otWarn << __FUNCTION__ <<
": Smart contract loaded up, but all "
5988 "parties are NOT confirmed.\n";
5991 else if (bVerified) {
6009 otOut << __FUNCTION__
6010 <<
": Suspicious: Smart contract loaded up, and is supposedly "
6011 "confirmed by all parties, but failed to verify:\n\n"
6012 << strContract <<
"\n\n";
6018 const std::string& THE_CONTRACT,
6019 const std::string& PARTY_NAME)
const
6023 if (THE_CONTRACT.empty()) {
6024 otErr << __FUNCTION__ <<
": Null: THE_CONTRACT passed in!\n";
6027 if (PARTY_NAME.empty()) {
6028 otErr << __FUNCTION__ <<
": Null: PARTY_NAME passed in!\n";
6031 const OTString strContract(THE_CONTRACT);
6032 std::unique_ptr<OTScriptable> pScriptable(
6034 if (
nullptr == pScriptable) {
6035 otOut << __FUNCTION__
6036 <<
": Failed trying to load smart contract from string : \n\n"
6037 << strContract <<
"\n\n";
6041 if (
nullptr == pParty) {
6042 otOut << __FUNCTION__
6043 <<
": Smart contract loaded up, but failed to find a party "
6044 "with the name: " << PARTY_NAME <<
"\n";
6052 <<
": Smart contract loaded up, and party " << PARTY_NAME
6053 <<
" was found, but didn't find a signed copy of the "
6054 "agreement for that party.\n";
6059 std::unique_ptr<OTScriptable> pPartySignedCopy(
6063 if (
nullptr == pPartySignedCopy) {
6064 const std::string current_party_name(
6066 otErr << __FUNCTION__ <<
": Error loading party's ("
6067 << current_party_name
6068 <<
") signed copy of agreement. Has it been "
6072 if (!pScriptable->
Compare(*pPartySignedCopy)) {
6073 const std::string current_party_name(
6075 otErr << __FUNCTION__ <<
": Suspicious: Party's ("
6076 << current_party_name
6077 <<
") signed copy of agreement doesn't match the "
6107 if (THE_CONTRACT.empty()) {
6108 otErr << __FUNCTION__ <<
": Null: THE_CONTRACT passed in!\n";
6111 OTString strContract(THE_CONTRACT);
6112 std::unique_ptr<OTScriptable> pScriptable(
6114 if (
nullptr == pScriptable) {
6115 otOut << __FUNCTION__
6116 <<
" Failed trying to load smart contract from string:\n\n"
6117 << strContract <<
"\n\n";
6120 const int32_t nReturnValue =
6121 static_cast<int32_t
>(pScriptable->GetPartyCount());
6122 return nReturnValue;
6129 if (THE_CONTRACT.empty()) {
6130 otErr << __FUNCTION__ <<
": Null: THE_CONTRACT passed in!\n";
6133 OTString strContract(THE_CONTRACT);
6134 std::unique_ptr<OTScriptable> pScriptable(
6136 if (
nullptr == pScriptable) {
6137 otOut << __FUNCTION__
6138 <<
": Failed trying to load smart contract from string : \n\n"
6139 << strContract <<
"\n\n";
6142 const int32_t nReturnValue =
6143 static_cast<int32_t
>(pScriptable->GetBylawCount());
6144 return nReturnValue;
6151 const int32_t& nIndex)
const
6153 if (THE_CONTRACT.empty()) {
6154 otErr << __FUNCTION__ <<
": Null: THE_CONTRACT passed in!\n";
6157 const OTString strContract(THE_CONTRACT);
6158 std::unique_ptr<OTScriptable> pScriptable(
6160 if (
nullptr == pScriptable) {
6161 otOut << __FUNCTION__
6162 <<
": Failed trying to load smart contract from string:\n\n"
6163 << strContract <<
"\n\n";
6166 const int32_t nTempIndex =
static_cast<const int32_t
>(nIndex);
6167 OTParty* pParty = pScriptable->GetPartyByIndex(
6169 if (
nullptr == pParty) {
6170 otOut << __FUNCTION__
6171 <<
": Smart contract loaded up, but failed to retrieve the "
6172 "party using index: " << nTempIndex <<
"\n";
6184 const int32_t& nIndex)
const
6186 if (THE_CONTRACT.empty()) {
6187 otErr << __FUNCTION__ <<
": Null: THE_CONTRACT passed in!\n";
6190 const OTString strContract(THE_CONTRACT);
6191 std::unique_ptr<OTScriptable> pScriptable(
6193 if (
nullptr == pScriptable) {
6194 otOut << __FUNCTION__
6195 <<
": Failed trying to load smart contract from string : \n\n"
6196 << strContract <<
"\n\n";
6199 const int32_t nTempIndex =
static_cast<const int32_t
>(nIndex);
6200 OTBylaw* pBylaw = pScriptable->GetBylawByIndex(
6202 if (
nullptr == pBylaw) {
6203 otOut << __FUNCTION__
6204 <<
": Smart contract loaded up, but failed to retrieve the "
6205 "bylaw using index: " << nTempIndex <<
"\n";
6209 const std::string str_name(pBylaw->
GetName().
Get());
6217 const std::string& BYLAW_NAME)
const
6219 if (THE_CONTRACT.empty()) {
6220 otErr << __FUNCTION__ <<
": Null: THE_CONTRACT passed in!\n";
6223 if (BYLAW_NAME.empty()) {
6224 otErr << __FUNCTION__ <<
": Null: BYLAW_NAME passed in!\n";
6227 OTString strContract(THE_CONTRACT);
6228 std::unique_ptr<OTScriptable> pScriptable(
6230 if (
nullptr == pScriptable) {
6231 otOut << __FUNCTION__
6232 <<
": Failed trying to load smart contract from string : \n\n"
6233 << strContract <<
"\n\n";
6236 OTBylaw* pBylaw = pScriptable->GetBylaw(BYLAW_NAME);
6237 if (
nullptr == pBylaw) {
6238 otOut << __FUNCTION__
6239 <<
": Smart contract loaded up, but failed to find a bylaw "
6240 "with the name: " << BYLAW_NAME <<
"\n";
6244 const std::string str_return(
nullptr == pBylaw->
GetLanguage()
6245 ?
"error_no_language"
6254 const std::string& BYLAW_NAME)
const
6256 if (THE_CONTRACT.empty()) {
6257 otErr << __FUNCTION__ <<
": Null: THE_CONTRACT passed in!\n";
6260 if (BYLAW_NAME.empty()) {
6261 otErr << __FUNCTION__ <<
": Null: BYLAW_NAME passed in!\n";
6264 OTString strContract(THE_CONTRACT);
6265 std::unique_ptr<OTScriptable> pScriptable(
6267 if (
nullptr == pScriptable) {
6268 otOut << __FUNCTION__
6269 <<
": Failed trying to load smart contract from string : \n\n"
6270 << strContract <<
"\n\n";
6273 OTBylaw* pBylaw = pScriptable->GetBylaw(BYLAW_NAME);
6274 if (
nullptr == pBylaw) {
6275 otOut << __FUNCTION__
6276 <<
": Smart contract loaded up, but failed to find a bylaw "
6277 "with the name: " << BYLAW_NAME <<
"\n";
6281 const int32_t nReturnValue =
6283 return nReturnValue;
6290 const std::string& BYLAW_NAME)
const
6292 if (THE_CONTRACT.empty()) {
6293 otErr << __FUNCTION__ <<
": Null: THE_CONTRACT passed in!\n";
6296 if (BYLAW_NAME.empty()) {
6297 otErr << __FUNCTION__ <<
": Null: BYLAW_NAME passed in!\n";
6300 OTString strContract(THE_CONTRACT);
6301 std::unique_ptr<OTScriptable> pScriptable(
6303 if (
nullptr == pScriptable) {
6304 otOut << __FUNCTION__
6305 <<
": Failed trying to load smart contract from string : \n\n"
6306 << strContract <<
"\n\n";
6309 OTBylaw* pBylaw = pScriptable->GetBylaw(BYLAW_NAME);
6310 if (
nullptr == pBylaw) {
6311 otOut << __FUNCTION__
6312 <<
": Smart contract loaded up, but failed to find a bylaw "
6313 "with the name: " << BYLAW_NAME <<
"\n";
6317 const int32_t nReturnValue =
6319 return nReturnValue;
6326 const std::string& BYLAW_NAME)
const
6328 if (THE_CONTRACT.empty()) {
6329 otErr << __FUNCTION__ <<
": Null: THE_CONTRACT passed in!\n";
6332 if (BYLAW_NAME.empty()) {
6333 otErr << __FUNCTION__ <<
": Null: BYLAW_NAME passed in!\n";
6336 OTString strContract(THE_CONTRACT);
6337 std::unique_ptr<OTScriptable> pScriptable(
6339 if (
nullptr == pScriptable) {
6340 otOut << __FUNCTION__
6341 <<
": Failed trying to load smart contract from string : \n\n"
6342 << strContract <<
"\n\n";
6345 OTBylaw* pBylaw = pScriptable->GetBylaw(BYLAW_NAME);
6346 if (
nullptr == pBylaw) {
6347 otOut << __FUNCTION__
6348 <<
": Smart contract loaded up, but failed to find a bylaw "
6349 "with the name: " << BYLAW_NAME <<
"\n";
6353 const int32_t nReturnValue =
6355 return nReturnValue;
6362 const std::string& BYLAW_NAME)
const
6364 if (THE_CONTRACT.empty()) {
6365 otErr << __FUNCTION__ <<
": Null: THE_CONTRACT passed in!\n";
6368 if (BYLAW_NAME.empty()) {
6369 otErr << __FUNCTION__ <<
": Null: BYLAW_NAME passed in!\n";
6372 OTString strContract(THE_CONTRACT);
6373 std::unique_ptr<OTScriptable> pScriptable(
6375 if (
nullptr == pScriptable) {
6376 otOut << __FUNCTION__
6377 <<
": Failed trying to load smart contract from string:\n\n"
6378 << strContract <<
"\n\n";
6381 OTBylaw* pBylaw = pScriptable->GetBylaw(BYLAW_NAME);
6382 if (
nullptr == pBylaw) {
6383 otOut << __FUNCTION__
6384 <<
": Smart contract loaded up, but failed to find a bylaw "
6385 "with the name: " << BYLAW_NAME <<
"\n";
6389 const int32_t nReturnValue =
6391 return nReturnValue;
6398 const std::string& THE_CONTRACT,
const std::string& BYLAW_NAME,
6399 const int32_t& nIndex)
const
6401 if (THE_CONTRACT.empty()) {
6402 otErr << __FUNCTION__ <<
": Null: THE_CONTRACT passed in!\n";
6405 if (BYLAW_NAME.empty()) {
6406 otErr << __FUNCTION__ <<
": Null: BYLAW_NAME passed in!\n";
6409 const OTString strContract(THE_CONTRACT);
6410 std::unique_ptr<OTScriptable> pScriptable(
6412 if (
nullptr == pScriptable) {
6413 otOut << __FUNCTION__
6414 <<
": Failed trying to load smart contract from string:\n\n"
6415 << strContract <<
"\n\n";
6419 if (
nullptr == pBylaw) {
6420 otOut << __FUNCTION__
6421 <<
": Smart contract loaded up, but failed to retrieve the "
6422 "bylaw with name: " << BYLAW_NAME <<
"\n";
6426 const int32_t nTempIndex =
static_cast<const int32_t
>(nIndex);
6430 if (
nullptr == pClause) {
6431 otOut << __FUNCTION__ <<
": Smart contract loaded up, and "
6432 "bylaw found, but failed to retrieve "
6433 "the clause at index: " << nTempIndex
6438 const std::string str_name(
6448 const std::string& THE_CONTRACT,
const std::string& BYLAW_NAME,
6449 const std::string& CLAUSE_NAME)
const
6451 if (THE_CONTRACT.empty()) {
6452 otErr << __FUNCTION__ <<
": Null: THE_CONTRACT passed in!\n";
6455 if (BYLAW_NAME.empty()) {
6456 otErr << __FUNCTION__ <<
": Null: BYLAW_NAME passed in!\n";
6459 if (CLAUSE_NAME.empty()) {
6460 otErr << __FUNCTION__ <<
": Null: CLAUSE_NAME passed in!\n";
6463 const OTString strContract(THE_CONTRACT);
6464 std::unique_ptr<OTScriptable> pScriptable(
6466 if (
nullptr == pScriptable) {
6467 otOut << __FUNCTION__
6468 <<
": Failed trying to load smart contract from string:\n\n"
6469 << strContract <<
"\n\n";
6473 if (
nullptr == pBylaw) {
6474 otOut << __FUNCTION__
6475 <<
": Smart contract loaded up, but failed to retrieve the "
6476 "bylaw with name: " << BYLAW_NAME <<
"\n";
6482 if (
nullptr == pClause) {
6483 otOut << __FUNCTION__ <<
": Smart contract loaded up, and "
6484 "bylaw found, but failed to retrieve "
6485 "the clause with name: " << CLAUSE_NAME
6490 const std::string str_return(pClause->
GetCode());
6499 const std::string& THE_CONTRACT,
const std::string& BYLAW_NAME,
6500 const int32_t& nIndex)
const
6502 if (THE_CONTRACT.empty()) {
6503 otErr << __FUNCTION__ <<
": Null: THE_CONTRACT passed in!\n";
6506 if (BYLAW_NAME.empty()) {
6507 otErr << __FUNCTION__ <<
": Null: BYLAW_NAME passed in!\n";
6510 const OTString strContract(THE_CONTRACT);
6511 std::unique_ptr<OTScriptable> pScriptable(
6513 if (
nullptr == pScriptable) {
6514 otOut << __FUNCTION__
6515 <<
": Failed trying to load smart contract from string:\n\n"
6516 << strContract <<
"\n\n";
6520 if (
nullptr == pBylaw) {
6521 otOut << __FUNCTION__
6522 <<
": Smart contract loaded up, but failed to retrieve the "
6523 "bylaw with name: " << BYLAW_NAME <<
"\n";
6527 const int32_t nTempIndex =
static_cast<const int32_t
>(nIndex);
6531 if (
nullptr == pVar) {
6532 otOut << __FUNCTION__ <<
": Smart contract loaded up, and "
6533 "bylaw found, but failed to retrieve "
6534 "the variable at index: " << nTempIndex
6539 const std::string str_name(pVar->
GetName().
Get());
6548 const std::string& THE_CONTRACT,
const std::string& BYLAW_NAME,
6549 const std::string& VARIABLE_NAME)
const
6551 if (THE_CONTRACT.empty()) {
6552 otErr << __FUNCTION__ <<
": Null: THE_CONTRACT passed in!\n";
6555 if (BYLAW_NAME.empty()) {
6556 otErr << __FUNCTION__ <<
": Null: BYLAW_NAME passed in!\n";
6559 if (VARIABLE_NAME.empty()) {
6560 otErr << __FUNCTION__ <<
": Null: VARIABLE_NAME passed in!\n";
6563 const OTString strContract(THE_CONTRACT);
6564 std::unique_ptr<OTScriptable> pScriptable(
6566 if (
nullptr == pScriptable) {
6567 otOut << __FUNCTION__
6568 <<
": Failed trying to load smart contract from string:\n\n"
6569 << strContract <<
"\n\n";
6573 if (
nullptr == pBylaw) {
6574 otOut << __FUNCTION__
6575 <<
": Smart contract loaded up, but failed to retrieve the "
6576 "bylaw with name: " << BYLAW_NAME <<
"\n";
6582 if (
nullptr == pVar) {
6583 otOut << __FUNCTION__
6584 <<
": Smart contract loaded up, and bylaw found, but "
6585 "failed to retrieve the variable with name: "
6586 << VARIABLE_NAME <<
"\n";
6590 const std::string str_return(
6593 : (pVar->
IsBool() ?
"boolean"
6605 const std::string& THE_CONTRACT,
const std::string& BYLAW_NAME,
6606 const std::string& VARIABLE_NAME)
const
6609 if (THE_CONTRACT.empty()) {
6610 otErr << __FUNCTION__ <<
": Null: THE_CONTRACT passed in!\n";
6613 if (BYLAW_NAME.empty()) {
6614 otErr << __FUNCTION__ <<
": Null: BYLAW_NAME passed in!\n";
6617 if (VARIABLE_NAME.empty()) {
6618 otErr << __FUNCTION__ <<
": Null: VARIABLE_NAME passed in!\n";
6621 const OTString strContract(THE_CONTRACT);
6622 std::unique_ptr<OTScriptable> pScriptable(
6624 if (
nullptr == pScriptable) {
6625 otOut << __FUNCTION__
6626 <<
": Failed trying to load smart contract from string:\n\n"
6627 << strContract <<
"\n\n";
6631 if (
nullptr == pBylaw) {
6632 otOut << __FUNCTION__
6633 <<
": Smart contract loaded up, but failed to retrieve the "
6634 "bylaw with name: " << BYLAW_NAME <<
"\n";
6640 if (
nullptr == pVar) {
6641 otOut << __FUNCTION__
6642 <<
": Smart contract loaded up, and bylaw found, but "
6643 "failed to retrieve the variable with name: "
6644 << VARIABLE_NAME <<
"\n";
6648 const std::string str_return(
6655 :
"error_access")));
6664 const std::string& BYLAW_NAME,
6665 const std::string& VARIABLE_NAME)
6668 if (THE_CONTRACT.empty()) {
6669 otErr << __FUNCTION__ <<
": Null: THE_CONTRACT passed in!\n";
6672 if (BYLAW_NAME.empty()) {
6673 otErr << __FUNCTION__ <<
": Null: BYLAW_NAME passed in!\n";
6676 if (VARIABLE_NAME.empty()) {
6677 otErr << __FUNCTION__ <<
": Null: VARIABLE_NAME passed in!\n";
6680 const OTString strContract(THE_CONTRACT);
6681 std::unique_ptr<OTScriptable> pScriptable(
6683 if (
nullptr == pScriptable) {
6684 otOut << __FUNCTION__
6685 <<
": Failed trying to load smart contract from string:\n\n"
6686 << strContract <<
"\n\n";
6690 if (
nullptr == pBylaw) {
6691 otOut << __FUNCTION__
6692 <<
": Smart contract loaded up, but failed to retrieve the "
6693 "bylaw with name: " << BYLAW_NAME <<
"\n";
6699 if (
nullptr == pVar) {
6700 otOut << __FUNCTION__
6701 <<
": Smart contract loaded up, and bylaw found, but "
6702 "failed to retrieve the variable with name: "
6703 << VARIABLE_NAME <<
"\n";
6707 std::string str_return;
6721 otErr << __FUNCTION__
6722 <<
": Error: Unknown variable type.\n";
6733 const std::string& THE_CONTRACT,
const std::string& BYLAW_NAME,
6734 const int32_t& nIndex)
const
6736 if (THE_CONTRACT.empty()) {
6737 otErr << __FUNCTION__ <<
": Null: THE_CONTRACT passed in!\n";
6740 if (BYLAW_NAME.empty()) {
6741 otErr << __FUNCTION__ <<
": Null: BYLAW_NAME passed in!\n";
6744 const OTString strContract(THE_CONTRACT);
6745 std::unique_ptr<OTScriptable> pScriptable(
6747 if (
nullptr == pScriptable) {
6748 otOut << __FUNCTION__
6749 <<
": Failed trying to load smart contract from string:\n\n"
6750 << strContract <<
"\n\n";
6754 if (
nullptr == pBylaw) {
6755 otOut << __FUNCTION__
6756 <<
": Smart contract loaded up, but failed to retrieve the "
6757 "bylaw with name: " << BYLAW_NAME <<
"\n";
6761 const int32_t nTempIndex =
static_cast<const int32_t
>(nIndex);
6771 const std::string& BYLAW_NAME,
6772 const std::string& HOOK_NAME)
const
6774 if (THE_CONTRACT.empty()) {
6775 otErr << __FUNCTION__ <<
": Null: THE_CONTRACT passed in!\n";
6778 if (BYLAW_NAME.empty()) {
6779 otErr << __FUNCTION__ <<
": Null: BYLAW_NAME passed in!\n";
6782 if (HOOK_NAME.empty()) {
6783 otErr << __FUNCTION__ <<
": Null: HOOK_NAME passed in!\n";
6786 const OTString strContract(THE_CONTRACT);
6787 std::unique_ptr<OTScriptable> pScriptable(
6789 if (
nullptr == pScriptable) {
6790 otOut << __FUNCTION__
6791 <<
": Failed trying to load smart contract from string:\n\n"
6792 << strContract <<
"\n\n";
6795 OTBylaw* pBylaw = pScriptable->GetBylaw(BYLAW_NAME);
6796 if (
nullptr == pBylaw) {
6797 otOut << __FUNCTION__
6798 <<
": Smart contract loaded up, but failed to retrieve the "
6799 "bylaw with name: " << BYLAW_NAME <<
"\n";
6804 const bool bGotHooks = pBylaw->
GetHooks(
6807 const int32_t nReturnValue =
6808 bGotHooks ?
static_cast<const int32_t
>(theResults.size())
6810 return nReturnValue;
6822 const std::string& BYLAW_NAME,
6823 const std::string& HOOK_NAME,
6824 const int32_t& nIndex)
const
6826 if (THE_CONTRACT.empty()) {
6827 otErr << __FUNCTION__ <<
": Null: THE_CONTRACT passed in!\n";
6830 if (BYLAW_NAME.empty()) {
6831 otErr << __FUNCTION__ <<
": Null: BYLAW_NAME passed in!\n";
6834 if (HOOK_NAME.empty()) {
6835 otErr << __FUNCTION__ <<
": Null: HOOK_NAME passed in!\n";
6838 const OTString strContract(THE_CONTRACT);
6839 std::unique_ptr<OTScriptable> pScriptable(
6841 if (
nullptr == pScriptable) {
6842 otOut << __FUNCTION__
6843 <<
": Failed trying to load smart contract from string:\n\n"
6844 << strContract <<
"\n\n";
6847 OTBylaw* pBylaw = pScriptable->GetBylaw(BYLAW_NAME);
6848 if (
nullptr == pBylaw) {
6849 otOut << __FUNCTION__
6850 <<
": Smart contract loaded up, but failed to retrieve the "
6851 "bylaw with name: " << BYLAW_NAME <<
"\n";
6857 if (pBylaw->
GetHooks(HOOK_NAME, theResults))
6861 if ((nIndex >= 0) &&
6862 (nIndex < static_cast<int64_t>(theResults.size()))) {
6863 int32_t nLoopIndex = -1;
6865 for (
auto& it : theResults) {
6870 if (nLoopIndex == nIndex) {
6871 const std::string str_return(
6884 const std::string& THE_CONTRACT,
const std::string& BYLAW_NAME,
6885 const int32_t& nIndex)
const
6887 if (THE_CONTRACT.empty()) {
6888 otErr << __FUNCTION__ <<
": Null: THE_CONTRACT passed in!\n";
6891 if (BYLAW_NAME.empty()) {
6892 otErr << __FUNCTION__ <<
": Null: BYLAW_NAME passed in!\n";
6895 const OTString strContract(THE_CONTRACT);
6896 std::unique_ptr<OTScriptable> pScriptable(
6898 if (
nullptr == pScriptable) {
6899 otOut << __FUNCTION__
6900 <<
": Failed trying to load smart contract from string:\n\n"
6901 << strContract <<
"\n\n";
6905 if (
nullptr == pBylaw) {
6906 otOut << __FUNCTION__
6907 <<
": Smart contract loaded up, but failed to retrieve the "
6908 "bylaw with name: " << BYLAW_NAME <<
"\n";
6912 const int32_t nTempIndex =
static_cast<const int32_t
>(nIndex);
6913 const std::string str_name(
6922 const std::string& BYLAW_NAME,
6923 const std::string& CALLBACK_NAME)
6927 if (THE_CONTRACT.empty()) {
6928 otErr << __FUNCTION__ <<
": Null: THE_CONTRACT passed in!\n";
6931 if (BYLAW_NAME.empty()) {
6932 otErr << __FUNCTION__ <<
": Null: BYLAW_NAME passed in!\n";
6935 if (CALLBACK_NAME.empty()) {
6936 otErr << __FUNCTION__ <<
": Null: CALLBACK_NAME passed in!\n";
6939 const OTString strContract(THE_CONTRACT);
6940 std::unique_ptr<OTScriptable> pScriptable(
6942 if (
nullptr == pScriptable) {
6943 otOut << __FUNCTION__
6944 <<
": Failed trying to load smart contract from string:\n\n"
6945 << strContract <<
"\n\n";
6949 if (
nullptr == pBylaw) {
6950 otOut << __FUNCTION__
6951 <<
": Smart contract loaded up, but failed to retrieve the "
6952 "bylaw with name: " << BYLAW_NAME <<
"\n";
6958 if (
nullptr == pClause) {
6959 otOut << __FUNCTION__
6960 <<
": Smart contract loaded up, and bylaw found, but "
6961 "failed to retrieve the clause for callback: "
6962 << CALLBACK_NAME <<
"\n";
6966 const std::string str_return(pClause->
GetName().
Get());
6975 const std::string& PARTY_NAME)
const
6977 if (THE_CONTRACT.empty()) {
6978 otErr << __FUNCTION__ <<
": Null: THE_CONTRACT passed in!\n";
6981 if (PARTY_NAME.empty()) {
6982 otErr << __FUNCTION__ <<
": Null: PARTY_NAME passed in!\n";
6985 OTString strContract(THE_CONTRACT);
6986 std::unique_ptr<OTScriptable> pScriptable(
6988 if (
nullptr == pScriptable) {
6989 otOut << __FUNCTION__
6990 <<
": Failed trying to load smart contract from string:\n\n"
6991 << strContract <<
"\n\n";
6994 OTParty* pParty = pScriptable->GetParty(PARTY_NAME);
6995 if (
nullptr == pParty) {
6996 otOut << __FUNCTION__
6997 <<
": Smart contract loaded up, but failed to find a party "
6998 "with the name: " << PARTY_NAME <<
"\n";
7002 const int32_t nReturnValue =
7004 return nReturnValue;
7011 const std::string& PARTY_NAME)
const
7013 if (THE_CONTRACT.empty()) {
7014 otErr << __FUNCTION__ <<
": Null: THE_CONTRACT passed in!\n";
7017 if (PARTY_NAME.empty()) {
7018 otErr << __FUNCTION__ <<
": Null: PARTY_NAME passed in!\n";
7021 OTString strContract(THE_CONTRACT);
7022 std::unique_ptr<OTScriptable> pScriptable(
7024 if (
nullptr == pScriptable) {
7025 otOut << __FUNCTION__
7026 <<
": Failed trying to load smart contract from string:\n\n"
7027 << strContract <<
"\n\n";
7030 OTParty* pParty = pScriptable->GetParty(PARTY_NAME);
7031 if (
nullptr == pParty) {
7032 otOut << __FUNCTION__
7033 <<
": Smart contract loaded up, but failed to find a party "
7034 "with the name: " << PARTY_NAME <<
"\n";
7038 const int32_t nReturnValue =
7040 return nReturnValue;
7047 const std::string& THE_CONTRACT,
7048 const std::string& PARTY_NAME)
const
7056 if (THE_CONTRACT.empty()) {
7057 otErr << __FUNCTION__ <<
": Null: THE_CONTRACT passed in!\n";
7060 if (PARTY_NAME.empty()) {
7061 otErr << __FUNCTION__ <<
": Null: PARTY_NAME passed in!\n";
7064 OTString strContract(THE_CONTRACT);
7065 std::unique_ptr<OTScriptable> pScriptable(
7067 if (
nullptr == pScriptable) {
7068 otOut << __FUNCTION__
7069 <<
": Failed trying to load smart contract from string:\n\n"
7070 << strContract <<
"\n\n";
7074 if (
nullptr == pParty) {
7075 otOut << __FUNCTION__
7076 <<
": Smart contract loaded up, but failed to find a party "
7077 "with the name: " << PARTY_NAME <<
"\n";
7088 const std::string& THE_CONTRACT,
const std::string& PARTY_NAME,
7089 const int32_t& nIndex)
const
7091 if (THE_CONTRACT.empty()) {
7092 otErr << __FUNCTION__ <<
": Null: THE_CONTRACT passed in!\n";
7095 if (PARTY_NAME.empty()) {
7096 otErr << __FUNCTION__ <<
": Null: PARTY_NAME passed in!\n";
7099 const OTString strContract(THE_CONTRACT);
7100 std::unique_ptr<OTScriptable> pScriptable(
7102 if (
nullptr == pScriptable) {
7103 otOut << __FUNCTION__
7104 <<
": Failed trying to load smart contract from string:\n\n"
7105 << strContract <<
"\n\n";
7109 if (
nullptr == pParty) {
7110 otOut << __FUNCTION__
7111 <<
": Smart contract loaded up, but failed to retrieve the "
7112 "party with name: " << PARTY_NAME <<
"\n";
7116 const int32_t nTempIndex =
static_cast<const int32_t
>(nIndex);
7119 if (
nullptr == pAcct) {
7120 otOut << __FUNCTION__ <<
": Smart contract loaded up, and "
7121 "party found, but failed to retrieve "
7122 "the account at index: " << nTempIndex
7127 const std::string str_name(pAcct->
GetName().
Get());
7136 const std::string& PARTY_NAME,
7137 const std::string& ACCT_NAME)
7141 if (THE_CONTRACT.empty()) {
7142 otErr << __FUNCTION__ <<
": Null: THE_CONTRACT passed in!\n";
7145 if (PARTY_NAME.empty()) {
7146 otErr << __FUNCTION__ <<
": Null: PARTY_NAME passed in!\n";
7149 if (ACCT_NAME.empty()) {
7150 otErr << __FUNCTION__ <<
": Null: ACCT_NAME passed in!\n";
7153 const OTString strContract(THE_CONTRACT);
7154 std::unique_ptr<OTScriptable> pScriptable(
7156 if (
nullptr == pScriptable) {
7157 otOut << __FUNCTION__
7158 <<
": Failed trying to load smart contract from string:\n\n"
7159 << strContract <<
"\n\n";
7163 if (
nullptr == pParty) {
7164 otOut << __FUNCTION__
7165 <<
": Smart contract loaded up, but failed to retrieve the "
7166 "party with name: " << PARTY_NAME <<
"\n";
7172 if (
nullptr == pAcct) {
7173 otOut << __FUNCTION__ <<
": Smart contract loaded up, and "
7174 "party found, but failed to retrieve "
7175 "party's account named: " << ACCT_NAME
7180 const std::string str_return(
7190 const std::string& PARTY_NAME,
7191 const std::string& ACCT_NAME)
7195 if (THE_CONTRACT.empty()) {
7196 otErr << __FUNCTION__ <<
": Null: THE_CONTRACT passed in!\n";
7199 if (PARTY_NAME.empty()) {
7200 otErr << __FUNCTION__ <<
": Null: PARTY_NAME passed in!\n";
7203 if (ACCT_NAME.empty()) {
7204 otErr << __FUNCTION__ <<
": Null: ACCT_NAME passed in!\n";
7207 const OTString strContract(THE_CONTRACT);
7208 std::unique_ptr<OTScriptable> pScriptable(
7210 if (
nullptr == pScriptable) {
7211 otOut << __FUNCTION__
7212 <<
": Failed trying to load smart contract from string:\n\n"
7213 << strContract <<
"\n\n";
7217 if (
nullptr == pParty) {
7218 otOut << __FUNCTION__
7219 <<
": Smart contract loaded up, but failed to retrieve the "
7220 "party with name: " << PARTY_NAME <<
"\n";
7226 if (
nullptr == pAcct) {
7227 otOut << __FUNCTION__ <<
": Smart contract loaded up, and "
7228 "party found, but failed to retrieve "
7229 "party's account named: " << ACCT_NAME
7234 const std::string str_return(
7244 const std::string& PARTY_NAME,
7245 const std::string& ACCT_NAME)
7249 if (THE_CONTRACT.empty()) {
7250 otErr << __FUNCTION__ <<
": Null: THE_CONTRACT passed in!\n";
7253 if (PARTY_NAME.empty()) {
7254 otErr << __FUNCTION__ <<
": Null: PARTY_NAME passed in!\n";
7257 if (ACCT_NAME.empty()) {
7258 otErr << __FUNCTION__ <<
": Null: ACCT_NAME passed in!\n";
7261 const OTString strContract(THE_CONTRACT);
7262 std::unique_ptr<OTScriptable> pScriptable(
7264 if (
nullptr == pScriptable) {
7265 otOut << __FUNCTION__
7266 <<
": Failed trying to load smart contract from string:\n\n"
7267 << strContract <<
"\n\n";
7271 if (
nullptr == pParty) {
7272 otOut << __FUNCTION__
7273 <<
": Smart contract loaded up, but failed to retrieve the "
7274 "party with name: " << PARTY_NAME <<
"\n";
7280 if (
nullptr == pAcct) {
7281 otOut << __FUNCTION__ <<
": Smart contract loaded up, and "
7282 "party found, but failed to retrieve "
7283 "party's account named: " << ACCT_NAME
7288 const std::string str_return(
7298 const std::string& THE_CONTRACT,
const std::string& PARTY_NAME,
7299 const int32_t& nIndex)
const
7301 if (THE_CONTRACT.empty()) {
7302 otErr << __FUNCTION__ <<
": Null: THE_CONTRACT passed in!\n";
7305 if (PARTY_NAME.empty()) {
7306 otErr << __FUNCTION__ <<
": Null: PARTY_NAME passed in!\n";
7309 const OTString strContract(THE_CONTRACT);
7310 std::unique_ptr<OTScriptable> pScriptable(
7312 if (
nullptr == pScriptable) {
7313 otOut << __FUNCTION__
7314 <<
": Failed trying to load smart contract from string:\n\n"
7315 << strContract <<
"\n\n";
7319 if (
nullptr == pParty) {
7320 otOut << __FUNCTION__
7321 <<
": Smart contract loaded up, but failed to retrieve the "
7322 "party with name: " << PARTY_NAME <<
"\n";
7326 const int32_t nTempIndex =
static_cast<const int32_t
>(nIndex);
7329 if (
nullptr == pAgent) {
7330 otOut << __FUNCTION__
7331 <<
": Smart contract loaded up, and party found, but "
7332 "failed to retrieve the agent at index: " << nTempIndex
7337 const std::string str_name(pAgent->
GetName().
Get());
7346 const std::string& PARTY_NAME,
7347 const std::string& AGENT_NAME)
7351 if (THE_CONTRACT.empty()) {
7352 otErr << __FUNCTION__ <<
": Null: THE_CONTRACT passed in!\n";
7355 if (PARTY_NAME.empty()) {
7356 otErr << __FUNCTION__ <<
": Null: PARTY_NAME passed in!\n";
7359 if (AGENT_NAME.empty()) {
7360 otErr << __FUNCTION__ <<
": Null: AGENT_NAME passed in!\n";
7363 const OTString strContract(THE_CONTRACT);
7364 std::unique_ptr<OTScriptable> pScriptable(
7366 if (
nullptr == pScriptable) {
7367 otOut << __FUNCTION__
7368 <<
": Failed trying to load smart contract from string:\n\n"
7369 << strContract <<
"\n\n";
7373 if (
nullptr == pParty) {
7374 otOut << __FUNCTION__
7375 <<
": Smart contract loaded up, but failed to retrieve the "
7376 "party with name: " << PARTY_NAME <<
"\n";
7382 if (
nullptr == pAgent) {
7383 otOut << __FUNCTION__ <<
": Smart contract loaded up, and "
7384 "party found, but failed to retrieve "
7385 "party's agent named: " << AGENT_NAME
7390 std::string str_return;
7393 const OTString strTemp(theAgentID);
7394 str_return = strTemp.
Get();
7421 const std::string& SERVER_ID,
const std::string& USER_ID,
7422 const std::string& THE_SMART_CONTRACT)
const
7424 if (SERVER_ID.empty()) {
7425 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
7428 if (USER_ID.empty()) {
7429 otErr << __FUNCTION__ <<
": Null: USER_ID passed in!\n";
7432 if (THE_SMART_CONTRACT.empty()) {
7433 otErr << __FUNCTION__ <<
": Null: THE_SMART_CONTRACT passed in!\n";
7437 const OTIdentifier theServerID(SERVER_ID), theUserID(USER_ID);
7438 const OTString strContract(THE_SMART_CONTRACT);
7459 const std::string& SERVER_ID,
const std::string& USER_ID,
7460 const int64_t& TRANSACTION_NUMBER,
const std::string& CLAUSE_NAME,
7461 const std::string& STR_PARAM)
const
7463 if (SERVER_ID.empty()) {
7464 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
7467 if (USER_ID.empty()) {
7468 otErr << __FUNCTION__ <<
": Null: USER_ID passed in!\n";
7471 if (0 > TRANSACTION_NUMBER) {
7472 otErr << __FUNCTION__ <<
": Null: TRANSACTION_NUMBER passed in!\n";
7475 if (CLAUSE_NAME.empty()) {
7476 otErr << __FUNCTION__ <<
": Null: CLAUSE_NAME passed in!\n";
7483 const OTIdentifier theServerID(SERVER_ID), theUserID(USER_ID);
7484 const OTString strClauseName(CLAUSE_NAME);
7485 const int64_t lTransactionNum = TRANSACTION_NUMBER;
7486 const OTString strParam((STR_PARAM.empty()) ?
"" : STR_PARAM);
7487 return OTAPI()->triggerClause(
7488 theServerID, theUserID, static_cast<int64_t>(lTransactionNum),
7489 strClauseName, STR_PARAM.empty() ?
nullptr : &strParam);
7553 const std::string& THE_MESSAGE,
const std::string& USER_ID,
7554 const bool& bHarvestingForRetry,
const bool& bReplyWasSuccess,
7555 const bool& bReplyWasFailure,
const bool& bTransactionWasSuccess,
7556 const bool& bTransactionWasFailure)
const
7559 if (!bIsInitialized) {
7560 otErr << __FUNCTION__
7561 <<
": Not initialized; call OT_API::Init first.\n";
7564 if (THE_MESSAGE.empty()) {
7565 otErr << __FUNCTION__ <<
": Null: THE_MESSAGE passed in!\n";
7568 if (USER_ID.empty()) {
7569 otErr << __FUNCTION__ <<
": Null: USER_ID passed in!\n";
7574 const OTString strMsg(THE_MESSAGE);
7576 otErr << __FUNCTION__
7577 <<
": Failed trying to load message from empty string.\n";
7584 const OTString& strCronItem = strMsg;
7586 otOut << __FUNCTION__ <<
": Attempting to harvest transaction numbers "
7587 "from cron item...\n";
7591 std::unique_ptr<OTCronItem> pCronItem(
7593 if (
nullptr == pCronItem) {
7594 otErr << __FUNCTION__
7595 <<
": Failed trying to load message from string.";
7597 otOut << __FUNCTION__
7598 <<
": Error trying to load the cron item from string (a cron "
7599 "item is a smart contract, or some other recurring "
7600 "transaction such as a market offer, or a payment plan.) "
7601 "Contents:\n\n" << strCronItem <<
"\n\n";
7624 if (strMsg.
Contains(
"currencyBasket")) {
7625 const OTString& strBasket = strMsg;
7627 otOut << __FUNCTION__ <<
": Attempting to harvest transaction numbers "
7628 "from a basket currency exchange request...\n";
7631 if (
nullptr == pNym)
return false;
7636 otErr << __FUNCTION__ <<
": Error: This is apparently NOT a "
7637 "basket exchange request!\nContents:\n"
7638 << strBasket <<
"\n";
7646 if (
nullptr == pAccount) {
7649 otErr << __FUNCTION__
7650 <<
": Error: Unable to find the main account based on "
7651 "the ID from the exchange request: " << strAcctID
7660 if (
nullptr == pServer) {
7662 otErr << __FUNCTION__
7663 <<
": Error: Unable to find the server based on the "
7664 "exchange request: " << strServerID <<
"\n";
7672 otErr << __FUNCTION__
7673 <<
": Error loading original basket request.\n";
7678 otErr << __FUNCTION__
7679 <<
": Failed trying to load message from string.\n";
7685 theMessage, theUserID, bHarvestingForRetry, bReplyWasSuccess,
7686 bReplyWasFailure, bTransactionWasSuccess, bTransactionWasFailure);
7687 return bSuccess ?
true :
false;
7761 const std::string& USER_ID)
const
7763 if (USER_ID.empty()) {
7764 otErr << __FUNCTION__ <<
": Null: USER_ID passed in!\n";
7771 OTAPI()->GetOrLoadNym(NYM_ID,
false, __FUNCTION__,
7775 if (
nullptr == pNym)
return "";
7781 otOut << __FUNCTION__
7782 <<
": Failure retrieving encryption pubkey from Nym: " << strNymID
7787 std::string pBuf = strPubkey.
Get();
7794 const std::string& USER_ID)
const
7796 if (USER_ID.empty()) {
7797 otErr << __FUNCTION__ <<
": Null: USER_ID passed in!\n";
7804 OTAPI()->GetOrLoadNym(NYM_ID,
false, __FUNCTION__,
7808 if (
nullptr == pNym)
return "";
7814 otOut << __FUNCTION__
7815 <<
": Failure retrieving signing pubkey from Nym: " << strNymID
7820 std::string pBuf = strPubkey.
Get();
7831 const std::string& USER_ID)
const
7833 if (USER_ID.empty()) {
7834 otErr << __FUNCTION__ <<
": Null: USER_ID passed in!\n";
7840 OTAPI()->GetOrLoadPrivateNym(NYM_ID);
7841 if (
nullptr == pNym)
return "";
7844 otOut << __FUNCTION__
7845 <<
": Failure retrieving encryption pubkey from Nym: " << strNymID
7850 std::string pBuf = strPubkey.
Get();
7857 const std::string& USER_ID)
const
7859 if (USER_ID.empty()) {
7860 otErr << __FUNCTION__ <<
": Null: USER_ID passed in!\n";
7866 OTAPI()->GetOrLoadPrivateNym(NYM_ID);
7867 if (
nullptr == pNym)
return "";
7870 otOut << __FUNCTION__
7871 <<
": Failure retrieving signing pubkey from Nym: " << strNymID
7876 std::string pBuf = strPubkey.
Get();
7889 const std::string& USER_ID)
const
7892 if (USER_ID.empty()) {
7893 otErr << __FUNCTION__ <<
": Null: USER_ID passed in!\n";
7898 OTAPI()->GetOrLoadPrivateNym(NYM_ID);
7899 if (
nullptr == pNym)
return false;
7908 const std::string& ASSET_TYPE_ID)
const
7910 if (SERVER_ID.empty()) {
7911 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
7914 if (ASSET_TYPE_ID.empty()) {
7915 otErr << __FUNCTION__ <<
": Null: ASSET_TYPE_ID passed in!\n";
7919 const OTIdentifier theServerID(SERVER_ID), theAssetID(ASSET_TYPE_ID);
7922 std::unique_ptr<Mint> pMint(
OTAPI()->
LoadMint(theServerID, theAssetID));
7924 if (
nullptr == pMint)
7925 otOut << __FUNCTION__
7926 <<
": Failure calling OT_API::LoadMint.\nServer: " << SERVER_ID
7927 <<
"\n Asset Type: " << ASSET_TYPE_ID <<
"\n";
7930 bool bExpired = pMint->Expired();
7932 if (!bExpired)
return true;
7938 const std::string& SERVER_ID,
7939 const std::string& ASSET_TYPE_ID)
const
7943 if (SERVER_ID.empty()) {
7944 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
7947 if (ASSET_TYPE_ID.empty()) {
7948 otErr << __FUNCTION__ <<
": Null: ASSET_TYPE_ID passed in!\n";
7957 std::unique_ptr<Mint> pMint(OTAPI()->LoadMint(theServerID, theAssetID));
7959 if (
nullptr == pMint)
7960 otOut << __FUNCTION__ <<
"OTAPI_Exec::LoadMint: Failure calling "
7961 "OT_API::LoadMint.\nServer: " << SERVER_ID
7962 <<
"\n Asset Type: " << ASSET_TYPE_ID <<
"\n";
7966 std::string pBuf = strOutput.
Get();
7973 const std::string& ASSET_TYPE_ID)
const
7975 if (ASSET_TYPE_ID.empty()) {
7976 otErr << __FUNCTION__ <<
": Null ASSET_TYPE_ID passed in!\n";
7984 std::unique_ptr<OTAssetContract> pContract(
7985 OTAPI()->LoadAssetContract(theAssetID));
7987 if (
nullptr == pContract) {
7988 otOut << __FUNCTION__
7989 <<
": Failure calling OT_API::LoadAssetContract.\n Asset Type: "
7990 << ASSET_TYPE_ID <<
"\n";
7995 std::string pBuf = strOutput.
Get();
8002 const std::string& SERVER_ID)
const
8004 if (SERVER_ID.empty()) {
8005 otErr << __FUNCTION__ <<
": Null SERVER_ID passed in!\n";
8013 std::unique_ptr<OTServerContract> pContract(
8014 OTAPI()->LoadServerContract(theServerID));
8016 if (
nullptr == pContract) {
8017 otOut << __FUNCTION__
8018 <<
": Failure calling OT_API::LoadServerContract.\nServer ID: "
8019 << SERVER_ID <<
"\n";
8024 std::string pBuf = strOutput.
Get();
8036 const std::string& SERVER_ID,
const std::string& USER_ID,
8037 const std::string& ACCOUNT_ID)
const
8039 if (SERVER_ID.empty()) {
8040 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
8043 if (USER_ID.empty()) {
8044 otErr << __FUNCTION__ <<
": Null: USER_ID passed in!\n";
8047 if (ACCOUNT_ID.empty()) {
8048 otErr << __FUNCTION__ <<
": Null: ACCOUNT_ID passed in!\n";
8058 std::unique_ptr<OTAccount> pAccount(
8059 OTAPI()->LoadAssetAccount(theServerID, theUserID, theAccountID));
8061 if (
nullptr == pAccount) {
8062 otOut << __FUNCTION__
8063 <<
": Failure calling OT_API::LoadAssetAccount.\nAccount ID: "
8064 << ACCOUNT_ID <<
"\n";
8069 std::string pBuf = strOutput.
Get();
8100 const std::string& SERVER_ID,
const std::string& USER_ID,
8101 const int64_t& REQUEST_NUMBER)
const
8104 if (SERVER_ID.empty()) {
8105 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
8108 if (USER_ID.empty()) {
8109 otErr << __FUNCTION__ <<
": Null: USER_ID passed in!\n";
8112 if (0 > REQUEST_NUMBER) {
8113 otErr << __FUNCTION__ <<
": Negative: REQUEST_NUMBER passed in!\n";
8120 const int64_t lRequestNumber = REQUEST_NUMBER;
8124 std::unique_ptr<OTLedger> pLedger(
8125 OTAPI()->LoadNymboxNoVerify(theServerID, theUserID));
8127 if (
nullptr == pLedger) {
8128 otOut << __FUNCTION__
8129 <<
": Failure calling OT_API::LoadNymboxNoVerify.\n";
8136 if (
nullptr == pTransaction) {
8138 <<
": No replyNotice transactions found in ledger with request "
8139 "number: " << lRequestNumber <<
"\n";
8171 if (
nullptr != pFullTransaction) {
8174 strOutput.
Set(*pFullTransaction);
8179 otErr << __FUNCTION__ <<
": good index but uncovered \"\" pointer "
8180 "after trying to load full version of "
8181 "receipt (from abbreviated.) Thus, saving "
8182 "abbreviated version instead, so I can "
8183 "still return SOMETHING.\n";
8184 OTPseudonym* pNym = OTAPI()->GetNym(theUserID, __FUNCTION__);
8185 if (
nullptr == pNym)
return "";
8203 std::string pBuf = strOutput.
Get();
8237 const std::string& SERVER_ID,
const std::string& USER_ID,
8238 const int64_t& REQUEST_NUMBER)
const
8241 if (SERVER_ID.empty()) {
8242 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
8245 if (USER_ID.empty()) {
8246 otErr << __FUNCTION__ <<
": Null: USER_ID passed in!\n";
8249 if (0 > REQUEST_NUMBER) {
8250 otErr << __FUNCTION__ <<
": Negative: REQUEST_NUMBER passed in!\n";
8257 const int64_t lRequestNumber = REQUEST_NUMBER;
8263 const bool& bTemp = OTAPI()->HaveAlreadySeenReply(
8264 theServerID, theUserID, static_cast<int64_t>(lRequestNumber));
8269 const std::string& USER_ID)
const
8273 if (SERVER_ID.empty()) {
8274 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
8277 if (USER_ID.empty()) {
8278 otErr << __FUNCTION__ <<
": Null: USER_ID passed in!\n";
8287 std::unique_ptr<OTLedger> pLedger(
8288 OTAPI()->LoadNymbox(theServerID, theUserID));
8290 if (
nullptr == pLedger) {
8291 otOut << __FUNCTION__ <<
": Failure calling OT_API::LoadNymbox.\n";
8296 std::string pBuf = strOutput.
Get();
8304 const std::string& SERVER_ID,
8305 const std::string& USER_ID)
const
8307 if (SERVER_ID.empty()) {
8308 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
8311 if (USER_ID.empty()) {
8312 otErr << __FUNCTION__ <<
": Null: USER_ID passed in!\n";
8321 std::unique_ptr<OTLedger> pLedger(
8322 OTAPI()->LoadNymboxNoVerify(theServerID, theUserID));
8324 if (
nullptr == pLedger) {
8325 otOut << __FUNCTION__
8326 <<
": Failure calling OT_API::LoadNymboxNoVerify.\n";
8331 std::string pBuf = strOutput.
Get();
8339 const std::string& SERVER_ID,
const std::string& USER_ID,
8340 const std::string& ACCOUNT_ID)
const
8343 if (SERVER_ID.empty()) {
8344 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
8347 if (USER_ID.empty()) {
8348 otErr << __FUNCTION__ <<
": Null: USER_ID passed in!\n";
8351 if (ACCOUNT_ID.empty()) {
8352 otErr << __FUNCTION__ <<
": Null: ACCOUNT_ID passed in!\n";
8362 std::unique_ptr<OTLedger> pLedger(
8363 OTAPI()->LoadInbox(theServerID, theUserID, theAccountID));
8365 if (
nullptr == pLedger) {
8367 <<
": Failure calling OT_API::LoadInbox.\nAccount ID : "
8368 << ACCOUNT_ID <<
"\n";
8373 std::string pBuf = strOutput.
Get();
8381 const std::string& SERVER_ID,
const std::string& USER_ID,
8382 const std::string& ACCOUNT_ID)
const
8384 if (SERVER_ID.empty()) {
8385 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
8388 if (USER_ID.empty()) {
8389 otErr << __FUNCTION__ <<
": Null: USER_ID passed in!\n";
8392 if (ACCOUNT_ID.empty()) {
8393 otErr << __FUNCTION__ <<
": Null: ACCOUNT_ID passed in!\n";
8403 std::unique_ptr<OTLedger> pLedger(
8404 OTAPI()->LoadInboxNoVerify(theServerID, theUserID, theAccountID));
8406 if (
nullptr == pLedger) {
8408 <<
": Failure calling OT_API::LoadInboxNoVerify.\nAccount ID : "
8409 << ACCOUNT_ID <<
"\n";
8414 std::string pBuf = strOutput.
Get();
8422 const std::string& USER_ID,
8423 const std::string& ACCOUNT_ID)
const
8425 if (SERVER_ID.empty()) {
8426 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
8429 if (USER_ID.empty()) {
8430 otErr << __FUNCTION__ <<
": Null: USER_ID passed in!\n";
8433 if (ACCOUNT_ID.empty()) {
8434 otErr << __FUNCTION__ <<
": Null: ACCOUNT_ID passed in!\n";
8444 std::unique_ptr<OTLedger> pLedger(
8447 if (
nullptr == pLedger) {
8449 <<
": Failure calling OT_API::LoadOutbox().\nAccount ID : "
8450 << ACCOUNT_ID <<
"\n";
8455 std::string pBuf = strOutput.
Get();
8463 const std::string& USER_ID,
8464 const std::string& ACCOUNT_ID)
const
8466 if (SERVER_ID.empty()) {
8467 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
8470 if (USER_ID.empty()) {
8471 otErr << __FUNCTION__ <<
": Null: USER_ID passed in!\n";
8474 if (ACCOUNT_ID.empty()) {
8475 otErr << __FUNCTION__ <<
": Null: ACCOUNT_ID passed in!\n";
8485 std::unique_ptr<OTLedger> pLedger(
8488 if (
nullptr == pLedger) {
8490 <<
": Failure calling OT_API::LoadOutboxNoVerify.\nAccount ID : "
8491 << ACCOUNT_ID <<
"\n";
8496 std::string pBuf = strOutput.
Get();
8504 const std::string& SERVER_ID,
const std::string& USER_ID)
const
8509 if (SERVER_ID.empty()) {
8510 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
8513 if (USER_ID.empty()) {
8514 otErr << __FUNCTION__ <<
": Null: USER_ID passed in!\n";
8523 std::unique_ptr<OTLedger> pLedger(
8524 OTAPI()->LoadPaymentInbox(theServerID, theUserID));
8526 if (
nullptr == pLedger) {
8528 <<
": Failure calling OT_API::LoadPaymentInbox.\n User ID : "
8534 std::string pBuf = strOutput.
Get();
8542 const std::string& SERVER_ID,
8543 const std::string& USER_ID)
const
8545 if (SERVER_ID.empty()) {
8546 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
8549 if (USER_ID.empty()) {
8550 otErr << __FUNCTION__ <<
": Null: USER_ID passed in!\n";
8559 std::unique_ptr<OTLedger> pLedger(
8560 OTAPI()->LoadPaymentInboxNoVerify(theServerID, theUserID));
8562 if (
nullptr == pLedger) {
8565 <<
": Failure calling OT_API::LoadPaymentInboxNoVerify.\nUser ID: "
8571 std::string pBuf = strOutput.
Get();
8579 const std::string& USER_ID,
8580 const std::string& ACCOUNT_ID)
const
8582 if (SERVER_ID.empty()) {
8583 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
8586 if (USER_ID.empty()) {
8587 otErr << __FUNCTION__ <<
": Null: USER_ID passed in!\n";
8590 if (ACCOUNT_ID.empty()) {
8591 otErr << __FUNCTION__ <<
": Null: ACCOUNT_ID passed in!\n";
8601 std::unique_ptr<OTLedger> pLedger(
8604 if (
nullptr == pLedger) {
8605 otWarn << __FUNCTION__ <<
": Failure calling OT_API::LoadRecordBox.\n";
8610 std::string pBuf = strOutput.
Get();
8617 const std::string& SERVER_ID,
const std::string& USER_ID,
8618 const std::string& ACCOUNT_ID)
const
8620 if (SERVER_ID.empty()) {
8621 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
8624 if (USER_ID.empty()) {
8625 otErr << __FUNCTION__ <<
": Null: USER_ID passed in!\n";
8628 if (ACCOUNT_ID.empty()) {
8629 otErr << __FUNCTION__ <<
": Null: ACCOUNT_ID passed in!\n";
8639 std::unique_ptr<OTLedger> pLedger(
8642 if (
nullptr == pLedger) {
8644 <<
": Failure calling OT_API::LoadRecordBoxNoVerify.\n";
8648 const OTString strOutput(*pLedger);
8649 std::string pBuf = strOutput.
Get();
8656 const std::string& USER_ID)
const
8658 if (SERVER_ID.empty()) {
8659 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
8662 if (USER_ID.empty()) {
8663 otErr << __FUNCTION__ <<
": Null: USER_ID passed in!\n";
8672 std::unique_ptr<OTLedger> pLedger(
8675 if (
nullptr == pLedger) {
8676 otWarn << __FUNCTION__ <<
": Failure calling OT_API::LoadExpiredBox.\n";
8681 std::string pBuf = strOutput.
Get();
8688 const std::string& SERVER_ID,
8689 const std::string& USER_ID)
const
8691 if (SERVER_ID.empty()) {
8692 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
8695 if (USER_ID.empty()) {
8696 otErr << __FUNCTION__ <<
": Null: USER_ID passed in!\n";
8705 std::unique_ptr<OTLedger> pLedger(
8706 OTAPI()->LoadExpiredBoxNoVerify(theServerID, theUserID));
8708 if (
nullptr == pLedger) {
8710 <<
": Failure calling OT_API::LoadExpiredBoxNoVerify.\n";
8714 const OTString strOutput(*pLedger);
8715 std::string pBuf = strOutput.
Get();
8722 const std::string& SERVER_ID,
const std::string& USER_ID,
8723 const bool& bIsInbox,
8724 const int32_t& nIndex,
8726 const bool& bSaveCopy)
const
8730 if (SERVER_ID.empty()) {
8731 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
8734 if (USER_ID.empty()) {
8735 otErr << __FUNCTION__ <<
": Null: USER_ID passed in!\n";
8742 return OTAPI()->RecordPayment(theServerID, theUserID, bIsInbox, nIndex,
8747 const std::string& SERVER_ID,
const std::string& USER_ID,
8748 const std::string& ACCOUNT_ID,
8749 const int32_t& nIndex,
8750 const bool& bClearAll)
const
8753 if (SERVER_ID.empty()) {
8754 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
8757 if (USER_ID.empty()) {
8758 otErr << __FUNCTION__ <<
": Null: USER_ID passed in!\n";
8761 if (ACCOUNT_ID.empty()) {
8762 otErr << __FUNCTION__ <<
": Null: ACCOUNT_ID passed in!\n";
8770 return OTAPI()->ClearRecord(theServerID, theUserID, theAcctID, nIndex,
8775 const std::string& USER_ID,
const int32_t& nIndex,
8776 const bool& bClearAll)
const
8780 if (SERVER_ID.empty()) {
8781 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
8784 if (USER_ID.empty()) {
8785 otErr << __FUNCTION__ <<
": Null: USER_ID passed in!\n";
8792 return OTAPI()->ClearExpired(theServerID, theUserID, nIndex, bClearAll);
8841 const std::string& USER_ID,
8842 const std::string& ACCOUNT_ID,
8843 const std::string& THE_LEDGER)
const
8845 if (SERVER_ID.empty()) {
8846 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
8849 if (USER_ID.empty()) {
8850 otErr << __FUNCTION__ <<
": Null: USER_ID passed in!\n";
8853 if (ACCOUNT_ID.empty()) {
8854 otErr << __FUNCTION__ <<
": Null: ACCOUNT_ID passed in!\n";
8857 if (THE_LEDGER.empty()) {
8858 otErr << __FUNCTION__ <<
": Null: THE_LEDGER passed in!\n";
8862 const OTIdentifier theServerID(SERVER_ID), theUserID(USER_ID),
8863 theAccountID(ACCOUNT_ID);
8866 OTLedger theLedger(theUserID, theAccountID, theServerID);
8870 otErr << __FUNCTION__
8871 <<
": Error loading ledger from string. Acct ID: " << strAcctID
8888 const std::string& SERVER_ID,
const std::string& USER_ID,
8889 const std::string& ACCOUNT_ID,
const std::string& ORIGINAL_LEDGER)
const
8891 if (SERVER_ID.empty()) {
8892 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
8895 if (USER_ID.empty()) {
8896 otErr << __FUNCTION__ <<
": Null: USER_ID passed in!\n";
8899 if (ACCOUNT_ID.empty()) {
8900 otErr << __FUNCTION__ <<
": Null: ACCOUNT_ID passed in!\n";
8903 if (ORIGINAL_LEDGER.empty()) {
8904 otErr << __FUNCTION__ <<
": Null: ORIGINAL_LEDGER passed in!\n";
8908 const OTIdentifier theServerID(SERVER_ID), theUserID(USER_ID),
8909 theAccountID(ACCOUNT_ID);
8911 theUserID,
false, __FUNCTION__);
8912 if (
nullptr == pNym)
return "";
8914 OTString strOriginalLedger(ORIGINAL_LEDGER);
8915 OTLedger theOriginalLedger(theUserID, theAccountID, theServerID);
8919 otErr << __FUNCTION__
8920 <<
": Error loading ledger from string. Acct ID: " << strAcctID
8927 otErr << __FUNCTION__
8928 <<
": Error verifying original ledger. Acct ID: " << strAcctID
8936 if (
nullptr == pResponseLedger) {
8938 otErr << __FUNCTION__
8939 <<
": Error generating response ledger. Acct ID: " << strAcctID
8943 pResponseLedger->SignContract(*pNym);
8944 pResponseLedger->SaveContract();
8946 OTString strOutput(*pResponseLedger);
8948 std::string pBuf = strOutput.
Get();
8967 const std::string& SERVER_ID,
const std::string& USER_ID,
8968 const std::string& ACCOUNT_ID,
const std::string& THE_LEDGER,
8969 const int32_t& nIndex)
const
8971 if (SERVER_ID.empty()) {
8972 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
8975 if (USER_ID.empty()) {
8976 otErr << __FUNCTION__ <<
": Null: USER_ID passed in!\n";
8979 if (ACCOUNT_ID.empty()) {
8980 otErr << __FUNCTION__ <<
": Null: ACCOUNT_ID passed in!\n";
8983 if (THE_LEDGER.empty()) {
8984 otErr << __FUNCTION__ <<
": Null: THE_LEDGER passed in!\n";
8989 otErr << __FUNCTION__
8990 <<
": nIndex is out of bounds (it's in the negative!)\n";
8994 const OTIdentifier theServerID(SERVER_ID), theUserID(USER_ID),
8995 theAccountID(ACCOUNT_ID);
8998 OTLedger theLedger(theUserID, theAccountID, theServerID);
9006 otErr << __FUNCTION__
9007 <<
": Error loading ledger from string, or loading box receipts "
9008 "subsequently. Acct ID: " << strAcctID <<
"\n";
9015 otErr << __FUNCTION__ <<
": out of bounds: " << nIndex <<
"\n";
9022 if (
nullptr == pTransaction) {
9023 otErr << __FUNCTION__
9024 <<
": Failure: good index but uncovered \"\" pointer: " << nIndex
9053 if (
nullptr == pTransaction) {
9054 otErr << __FUNCTION__ <<
": good index but uncovered \"\" pointer "
9055 "after trying to load full version of "
9056 "receipt (from abbreviated): " << nIndex
9072 const OTString strOutput(*pTransaction);
9073 std::string pBuf = strOutput.
Get();
9085 const std::string& SERVER_ID,
const std::string& USER_ID,
9086 const std::string& ACCOUNT_ID,
const std::string& THE_LEDGER,
9087 const int64_t& TRANSACTION_NUMBER)
const
9089 if (SERVER_ID.empty()) {
9090 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
9093 if (USER_ID.empty()) {
9094 otErr << __FUNCTION__ <<
": Null: USER_ID passed in!\n";
9097 if (ACCOUNT_ID.empty()) {
9098 otErr << __FUNCTION__ <<
": Null: ACCOUNT_ID passed in!\n";
9101 if (THE_LEDGER.empty()) {
9102 otErr << __FUNCTION__ <<
": Null: THE_LEDGER passed in!\n";
9105 if (0 > TRANSACTION_NUMBER) {
9106 otErr << __FUNCTION__ <<
": Negative: TRANSACTION_NUMBER passed in!\n";
9110 const int64_t lTransactionNumber = TRANSACTION_NUMBER;
9112 if (0 > lTransactionNumber) {
9113 otErr << __FUNCTION__
9114 <<
": Bad transaction number passed in (negative value)\n";
9118 const OTIdentifier theServerID(SERVER_ID), theUserID(USER_ID),
9119 theAccountID(ACCOUNT_ID);
9123 OTLedger theLedger(theUserID, theAccountID, theServerID);
9127 otErr << __FUNCTION__
9128 <<
": Error loading ledger from string. Acct ID: " << strAcctID
9135 theLedger.
GetTransaction(static_cast<int64_t>(lTransactionNumber));
9138 if (
nullptr == pTransaction) {
9139 otOut << __FUNCTION__
9140 <<
": No transaction found in ledger with that number : "
9141 << lTransactionNumber <<
".\n";
9150 OT_ASSERT(lTransactionNum == lTransactionNumber);
9173 static_cast<int64_t>(lTransactionNum));
9180 if (bLoadedBoxReceipt)
9186 if (
nullptr == pTransaction) {
9187 otErr << __FUNCTION__ <<
": good ID, but uncovered \"\" pointer "
9188 "after trying to load full version of "
9189 "receipt (from abbreviated.) Probably "
9190 "just need to download this one...\n";
9202 if (
nullptr == pNym)
return "";
9208 const OTString strOutput(*pTransaction);
9209 std::string pBuf = strOutput.
Get();
9258 const std::string& SERVER_ID,
const std::string& USER_ID,
9259 const std::string& ACCOUNT_ID,
const std::string& THE_LEDGER,
9260 const int32_t& nIndex)
const
9262 if (SERVER_ID.empty()) {
9263 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
9266 if (USER_ID.empty()) {
9267 otErr << __FUNCTION__ <<
": Null: USER_ID passed in!\n";
9270 if (ACCOUNT_ID.empty()) {
9271 otErr << __FUNCTION__ <<
": Null: ACCOUNT_ID passed in!\n";
9274 if (THE_LEDGER.empty()) {
9275 otErr << __FUNCTION__ <<
": Null: THE_LEDGER passed in!\n";
9279 const OTIdentifier theServerID(SERVER_ID), theUserID(USER_ID),
9280 theAccountID(ACCOUNT_ID);
9281 OTPseudonym* pNym = OTAPI()->GetNym(theUserID, __FUNCTION__);
9282 if (
nullptr == pNym)
return "";
9284 OTLedger theLedger(theUserID, theAccountID, theServerID);
9295 otErr << __FUNCTION__
9296 <<
": Error loading ledger from string. UserID / Acct ID: "
9297 << strUserID <<
" / " << strAcctID <<
"\n";
9302 std::unique_ptr<OTPayment> pPayment(
9305 if ((
nullptr == pPayment) || !pPayment->
IsValid()) {
9306 otOut << __FUNCTION__ <<
": theLedger.GetInstrument either returned "
9307 "nullptr, or an invalid instrument.\n";
9319 otOut << __FUNCTION__ <<
": Failed retrieving payment instrument "
9320 "from OTPayment object.\n";
9323 std::string gBuf = strPaymentContents.
Get();
9371 const std::string& SERVER_ID,
const std::string& USER_ID,
9372 const std::string& ACCOUNT_ID,
const std::string& THE_LEDGER,
9373 const int32_t& nIndex)
const
9375 if (SERVER_ID.empty()) {
9376 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
9379 if (USER_ID.empty()) {
9380 otErr << __FUNCTION__ <<
": Null: USER_ID passed in!\n";
9383 if (ACCOUNT_ID.empty()) {
9384 otErr << __FUNCTION__ <<
": Null: ACCOUNT_ID passed in!\n";
9387 if (THE_LEDGER.empty()) {
9388 otErr << __FUNCTION__ <<
": Null: THE_LEDGER passed in!\n";
9393 otErr << __FUNCTION__
9394 <<
": nIndex is out of bounds (it's in the negative!)\n";
9398 const OTIdentifier theServerID(SERVER_ID), theUserID(USER_ID),
9399 theAccountID(ACCOUNT_ID);
9404 int64_t lTransactionNumber = 0;
9407 OTLedger theLedger(theUserID, theAccountID, theServerID);
9411 otErr << __FUNCTION__
9412 <<
": Error loading ledger from string. Acct ID: " << strAcctID
9418 otErr << __FUNCTION__ <<
": out of bounds: " << nIndex <<
"\n";
9424 otErr << __FUNCTION__
9425 <<
": good index but uncovered \"\" pointer: " << nIndex <<
"\n";
9432 otErr << __FUNCTION__
9433 <<
": negative or zero transaction num: " << lTransactionNumber
9439 return lTransactionNumber;
9449 const std::string& SERVER_ID,
const std::string& USER_ID,
9450 const std::string& ACCOUNT_ID,
const std::string& THE_LEDGER,
9451 const std::string& THE_TRANSACTION)
const
9453 if (SERVER_ID.empty()) {
9454 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
9457 if (USER_ID.empty()) {
9458 otErr << __FUNCTION__ <<
": Null: USER_ID passed in!\n";
9461 if (ACCOUNT_ID.empty()) {
9462 otErr << __FUNCTION__ <<
": Null: ACCOUNT_ID passed in!\n";
9465 if (THE_LEDGER.empty()) {
9466 otErr << __FUNCTION__ <<
": Null: THE_LEDGER passed in!\n";
9469 if (THE_TRANSACTION.empty()) {
9470 otErr << __FUNCTION__ <<
": Null: THE_TRANSACTION passed in!\n";
9474 const OTIdentifier theServerID(SERVER_ID), theUserID(USER_ID),
9475 theAccountID(ACCOUNT_ID);
9478 OTString strTransaction(THE_TRANSACTION);
9481 theUserID,
false, __FUNCTION__);
9482 if (
nullptr == pNym)
return "";
9484 OTLedger theLedger(theUserID, theAccountID, theServerID);
9488 otErr << __FUNCTION__
9489 <<
": Error loading ledger from string. Acct ID: " << strAcctID
9495 otErr << __FUNCTION__
9496 <<
": Error verifying ledger in "
9497 "OTAPI_Exec::Ledger_AddTransaction. Acct ID: " << strAcctID
9506 if (
nullptr == pTransaction) {
9507 otErr << __FUNCTION__ <<
": Error allocating memory in the OTAPI: "
9515 otErr << __FUNCTION__
9516 <<
": Error loading transaction from string. Acct ID: "
9517 << strAcctID <<
"\n";
9518 delete pTransaction;
9519 pTransaction =
nullptr;
9524 otErr << __FUNCTION__
9525 <<
": Error verifying transaction. Acct ID: " << strAcctID
9527 delete pTransaction;
9528 pTransaction =
nullptr;
9544 std::string pBuf = strOutput.
Get();
9564 const std::string& SERVER_ID,
const std::string& USER_ID,
9565 const std::string& ACCOUNT_ID,
9566 const std::string& THE_LEDGER,
9567 const std::string& THE_TRANSACTION,
9568 const bool& BOOL_DO_I_ACCEPT)
const
9570 if (SERVER_ID.empty()) {
9571 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
9574 if (USER_ID.empty()) {
9575 otErr << __FUNCTION__ <<
": Null: USER_ID passed in!\n";
9578 if (ACCOUNT_ID.empty()) {
9579 otErr << __FUNCTION__ <<
": Null: ACCOUNT_ID passed in!\n";
9582 if (THE_LEDGER.empty()) {
9583 otErr << __FUNCTION__ <<
": Null: THE_LEDGER passed in!\n";
9586 if (THE_TRANSACTION.empty()) {
9587 otErr << __FUNCTION__ <<
": Null: THE_TRANSACTION passed in!\n";
9591 const OTIdentifier theServerID(SERVER_ID), theUserID(USER_ID),
9592 theAcctID(ACCOUNT_ID);
9595 OTString strTransaction(THE_TRANSACTION);
9597 if (
nullptr == pServer)
return "";
9601 if (
nullptr == pServerNym) {
9602 otOut << __FUNCTION__
9603 <<
": No Contract Nym found in that Server Contract.\n";
9608 theUserID,
false, __FUNCTION__);
9609 if (
nullptr == pNym)
return "";
9612 OTLedger theLedger(theUserID, theAcctID, theServerID);
9616 otErr << __FUNCTION__
9617 <<
": Error loading ledger from string. Acct ID: " << strAcctID
9623 otErr << __FUNCTION__
9624 <<
": Error verifying ledger. Acct ID: " << strAcctID <<
"\n";
9632 OTTransaction theTransaction(theUserID, theAcctID, theServerID);
9636 otErr << __FUNCTION__
9637 <<
": Error loading transaction from string. Acct ID: "
9638 << strAcctID <<
"\n";
9642 std::unique_ptr<OTTransaction> theTransAngel;
9648 if (
nullptr == pTransaction) {
9650 otErr << __FUNCTION__ <<
": Error loading full transaction from "
9651 "abbreviated version of inbox receipt. "
9652 "Acct ID: " << strAcctID <<
"\n";
9655 theTransAngel.reset(pTransaction);
9658 pTransaction = &theTransaction;
9667 pTransaction->
VerifyAccount(*(const_cast<OTPseudonym*>(pServerNym)))) {
9669 otErr << __FUNCTION__
9670 <<
": Error verifying transaction. Acct ID: " << strAcctID
9683 otErr << __FUNCTION__
9684 <<
": wrong transaction type: " << pTransaction->
GetTypeString()
9699 if (
nullptr == pResponse) {
9701 int64_t lTransactionNumber = 0;
9705 if (!bGotTransNum) {
9707 otOut << __FUNCTION__
9708 <<
": User is all out of transaction numbers:\n" << strNymID
9715 lTransactionNumber);
9717 if (
nullptr == pResponse) {
9719 otErr << __FUNCTION__
9720 <<
": Error generating processInbox transaction for AcctID: "
9721 << strAcctID <<
"\n";
9744 switch (pTransaction->
GetType()) {
9776 otErr << __FUNCTION__ <<
": Unexpected transaction type in: "
9780 int64_t lReferenceTransactionNum = 0;
9781 int64_t lNumberOfOrigin = 0;
9783 switch (pTransaction->
GetType()) {
9789 lReferenceTransactionNum =
9810 if (!strReference.
Exists()) {
9811 otErr << __FUNCTION__
9812 <<
": No reference string found on transaction.\n";
9818 if (
nullptr == pOriginalItem) {
9819 otErr << __FUNCTION__
9820 <<
": Failed loading transaction item from string.\n";
9842 otErr << __FUNCTION__ <<
": Wrong item type or status attached "
9843 "as reference on transaction.\n";
9847 pOriginalItem->
GetNote(strNote);
9849 lReferenceTransactionNum =
9864 otErr << __FUNCTION__ <<
": Unexpected transaction type in: "
9869 *pResponse, (
true == BOOL_DO_I_ACCEPT)
9871 : theRejectItemType);
9878 lReferenceTransactionNum));
9918 pResponse->
AddItem(*pAcceptItem);
9936 std::string pBuf = strOutput.
Get();
9955 const std::string& USER_ID,
9956 const std::string& ACCOUNT_ID,
9957 const std::string& THE_LEDGER)
9960 if (SERVER_ID.empty()) {
9961 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
9964 if (USER_ID.empty()) {
9965 otErr << __FUNCTION__ <<
": Null: USER_ID passed in!\n";
9968 if (ACCOUNT_ID.empty()) {
9969 otErr << __FUNCTION__ <<
": Null: ACCOUNT_ID passed in!\n";
9972 if (THE_LEDGER.empty()) {
9973 otErr << __FUNCTION__ <<
": Null: THE_LEDGER passed in!\n";
9977 const OTIdentifier theServerID(SERVER_ID), theUserID(USER_ID),
9978 theAcctID(ACCOUNT_ID);
9980 OTString strLedger(THE_LEDGER), strServerID(theServerID);
9982 if (
nullptr == pServer)
return "";
9986 if (
nullptr == pServerNym) {
9987 otOut << __FUNCTION__
9988 <<
": No Contract Nym found in that Server Contract.\n";
9993 theUserID,
false, __FUNCTION__);
9994 if (
nullptr == pNym)
return "";
9997 OTLedger theLedger(theUserID, theAcctID, theServerID);
10001 otErr << __FUNCTION__
10002 <<
": Error loading ledger from string. Acct ID: " << strAcctID
10008 otErr << __FUNCTION__
10009 <<
": Error verifying ledger. Acct ID: " << strAcctID <<
"\n";
10024 if (
nullptr == pTransaction) {
10026 otErr << __FUNCTION__
10027 <<
": Error finding processInbox transaction for AcctID: "
10028 << strAcctID <<
"\n";
10036 otErr << __FUNCTION__
10037 <<
": this response has already been finalized.\n";
10041 OTAccount* pAccount = OTAPI()->GetAccount(theAcctID, __FUNCTION__);
10042 if (
nullptr == pAccount)
return "";
10045 OTLedger theInbox(theUserID, theAcctID, theServerID);
10046 OTLedger theOutbox(theUserID, theAcctID, theServerID);
10049 otOut << __FUNCTION__ <<
": Unable to load or verify Inbox for acct "
10050 << ACCOUNT_ID <<
"\n";
10055 otOut << __FUNCTION__ <<
": Unable to load or verify Outbox for acct "
10056 << ACCOUNT_ID <<
"\n";
10084 bool bSuccessFindingAllTransactions =
true;
10085 int64_t lTotalBeingAccepted = 0;
10087 std::list<int64_t> theListOfInboxReceiptsBeingRemoved;
10091 for (
auto& it_bigloop : pTransaction->
GetItemList()) {
10092 OTItem* pItem = it_bigloop;
10093 if (
nullptr == pItem) {
10094 otErr << __FUNCTION__
10095 <<
": Pointer: pItem should not have been \"\".\n";
10115 <<
": Checking inbox for expected pending or receipt ("
10119 if (
nullptr == pServerTransaction) {
10120 bSuccessFindingAllTransactions =
false;
10121 otOut << __FUNCTION__ <<
": Expected receipt "
10123 <<
" NOT found! (Do you have the latest inbox?)\n";
10127 bSuccessFindingAllTransactions =
true;
10141 lTotalBeingAccepted +=
10143 ->GetReceiptAmount();
10158 std::unique_ptr<OTItem> pOriginalItem(
10160 strOriginalItem, SERVER_ID.c_str(),
10163 if (
nullptr != pOriginalItem) {
10208 otErr << __FUNCTION__
10209 <<
": ERROR loading cheque from string:\n"
10210 << strCheque <<
"\n";
10224 otErr << __FUNCTION__
10225 <<
": cheque receipt, trying to "
10226 "'remove' an issued number ("
10228 <<
") that already wasn't on my "
10229 "issued list. (So what is this in "
10230 "my inbox, then? Maybe need to "
10231 "download a fresh copy of it.)\n";
10252 otErr << __FUNCTION__
10253 <<
": transferReceipt, trying to "
10254 "'remove' an issued number ("
10256 <<
") that already wasn't on my issued "
10257 "list. (So what is this in my inbox, "
10258 "then? Maybe need to download a fresh "
10265 otErr << __FUNCTION__
10266 <<
": Original item has wrong type, while "
10267 "accepting item receipt:\n"
10268 << strOriginalItemType <<
"\n";
10272 otErr << __FUNCTION__
10273 <<
": Unable to load original item from string "
10274 "while accepting item receipt:\n"
10275 << strOriginalItem <<
"\n";
10292 theListOfInboxReceiptsBeingRemoved.push_back(
10304 <<
": Checking client-side inbox for expected cron or final "
10308 if (
nullptr == pServerTransaction) {
10309 bSuccessFindingAllTransactions =
false;
10310 otInfo << __FUNCTION__ <<
": NOT found!(Do you have the latest "
10315 bSuccessFindingAllTransactions =
true;
10368 std::set<int64_t> setOfRefNumbers;
10384 OTItem* pItemPointer = it;
10385 if (
nullptr == pItemPointer) {
10386 otErr << __FUNCTION__ <<
": Pointer: "
10387 "pItemPointer should "
10388 "not have been .\n";
10415 if ((
nullptr != pTransPointer) &&
10420 setOfRefNumbers.insert(
10426 if (static_cast<int32_t>(
10427 setOfRefNumbers.size()) !=
10438 <<
": When accepting a finalReceipt, you MUST "
10439 "accept all related receipts (ones that "
10440 "share the same IN REFERENCE TO transaction "
10441 "number as the finalReceipt "
10444 "Transaction item count (in ref to): "
10445 << setOfRefNumbers.size()
10446 <<
" Inbox transaction count (in ref to): "
10451 bSuccessFindingAllTransactions =
false;
10469 pServerTransaction->
GetType()) {
10471 *pNym, strServerID,
10476 <<
": **** Due to finding a finalReceipt, "
10477 "REMOVING OPENING NUMBER FROM NYM: "
10483 <<
": **** Noticed a finalReceipt, but "
10486 <<
" had ALREADY been removed from nym. \n";
10489 otErr << __FUNCTION__
10490 <<
": Expected pServerTransaction to be a "
10491 "final receipt (while finalizing for "
10492 "process inbox.)\n";
10516 otErr << __FUNCTION__
10517 <<
": final or basket Receipt, trying to "
10518 "'remove' an issued number ("
10520 <<
") that already wasn't on my issued list. (So "
10521 "what is this in my inbox, then? Maybe need "
10522 "to download a fresh copy of it.)\n";
10528 otErr << __FUNCTION__
10529 <<
": Unexpected item type: " << strTempType <<
"\n";
10550 theListOfInboxReceiptsBeingRemoved.push_back(
10556 if (!bSuccessFindingAllTransactions)
10558 otOut << __FUNCTION__ <<
": transactions in processInbox message do "
10559 "not match actual inbox.\n";
10565 while (!theListOfInboxReceiptsBeingRemoved.empty()) {
10566 int64_t lTemp = theListOfInboxReceiptsBeingRemoved.front();
10567 theListOfInboxReceiptsBeingRemoved.pop_front();
10571 static_cast<int64_t>(lTemp)))
10572 otErr << __FUNCTION__
10573 <<
": Failed removing receipt from temporary Inbox: " << lTemp
10591 int64_t lTemp = theTempNym.
GetIssuedNum(theServerID, i);
10600 static_cast<int64_t>(lTotalBeingAccepted), *pTransaction, *pNym,
10601 *pAccount, theOutbox);
10610 int64_t lTemp = theTempNym.
GetIssuedNum(theServerID, i);
10611 pNym->
AddIssuedNum(strServerID, static_cast<int64_t>(lTemp));
10614 if (
nullptr == pBalanceItem) {
10615 otOut << __FUNCTION__ <<
": ERROR generating balance statement.\n";
10621 pTransaction->
AddItem(*pBalanceItem);
10641 std::string pBuf = strOutput.
Get();
10676 const std::string& SERVER_ID,
const std::string& USER_ID,
10677 const std::string& ACCOUNT_ID,
const std::string& THE_TRANSACTION)
const
10679 if (SERVER_ID.empty()) {
10680 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
10683 if (USER_ID.empty()) {
10684 otErr << __FUNCTION__ <<
": Null: USER_ID passed in!\n";
10687 if (ACCOUNT_ID.empty()) {
10688 otErr << __FUNCTION__ <<
": Null: ACCOUNT_ID passed in!\n";
10691 if (THE_TRANSACTION.empty()) {
10692 otErr << __FUNCTION__ <<
": Null: THE_TRANSACTION passed in!\n";
10696 const OTIdentifier theServerID(SERVER_ID), theUserID(USER_ID),
10697 theAccountID(ACCOUNT_ID);
10699 OTString strTransaction(THE_TRANSACTION);
10704 theUserID,
false, __FUNCTION__);
10705 if (
nullptr == pNym)
return "";
10707 OTTransaction theTransaction(theUserID, theAccountID, theServerID);
10711 otErr << __FUNCTION__
10712 <<
": Error loading transaction from string. Acct ID: "
10713 << strAcctID <<
"\n";
10722 otErr << __FUNCTION__ <<
": Error: tried to retrieve voucher from "
10723 "wrong transaction (not atWithdrawal).\n";
10734 if (
nullptr == pItem) {
10735 otErr << __FUNCTION__ <<
": Pointer: "
10737 <<
" should not have been .\n";
10760 if (!strOutput.
Exists())
return "";
10764 std::string pBuf = strOutput.
Get();
10770 const std::string& SERVER_ID,
const std::string& USER_ID,
10771 const std::string& ACCOUNT_ID,
const std::string& THE_TRANSACTION)
const
10773 if (SERVER_ID.empty()) {
10774 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
10777 if (USER_ID.empty()) {
10778 otErr << __FUNCTION__ <<
": Null: USER_ID passed in!\n";
10781 if (ACCOUNT_ID.empty()) {
10782 otErr << __FUNCTION__ <<
": Null: ACCOUNT_ID passed in!\n";
10785 if (THE_TRANSACTION.empty()) {
10786 otErr << __FUNCTION__ <<
": Null: THE_TRANSACTION passed in!\n";
10790 const OTIdentifier theServerID(SERVER_ID), theUserID(USER_ID),
10791 theAccountID(ACCOUNT_ID);
10793 OTString strTransaction(THE_TRANSACTION);
10796 theUserID,
false, __FUNCTION__);
10797 if (
nullptr == pNym)
return "";
10799 OTTransaction theTransaction(theUserID, theAccountID, theServerID);
10803 otErr << __FUNCTION__
10804 <<
": Error loading transaction from string. Acct ID: "
10805 << strAcctID <<
"\n";
10809 std::unique_ptr<OTTransaction> theTransAngel;
10812 int64_t lBoxType = 0;
10814 if (theTransaction.
Contains(
"nymboxRecord"))
10816 else if (theTransaction.
Contains(
"inboxRecord"))
10818 else if (theTransaction.
Contains(
"outboxRecord"))
10820 else if (theTransaction.
Contains(
"paymentInboxRecord"))
10822 else if (theTransaction.
Contains(
"recordBoxRecord"))
10824 else if (theTransaction.
Contains(
"expiredBoxRecord"))
10827 otErr << __FUNCTION__ <<
": Error loading from abbreviated "
10828 "transaction: unknown ledger type.\n";
10833 if (
nullptr == pTransaction) {
10834 otErr << __FUNCTION__ <<
": Error loading from abbreviated "
10835 "transaction: failed loading box "
10839 theTransAngel.reset(pTransaction);
10842 pTransaction = &theTransaction;
10851 if (!strOutput.
Exists())
return "";
10855 std::string pBuf = strOutput.
Get();
10864 const std::string& SERVER_ID,
const std::string& USER_ID,
10865 const std::string& ACCOUNT_ID,
const std::string& THE_TRANSACTION)
const
10867 if (SERVER_ID.empty()) {
10868 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
10871 if (USER_ID.empty()) {
10872 otErr << __FUNCTION__ <<
": Null: USER_ID passed in!\n";
10875 if (ACCOUNT_ID.empty()) {
10876 otErr << __FUNCTION__ <<
": Null: ACCOUNT_ID passed in!\n";
10879 if (THE_TRANSACTION.empty()) {
10880 otErr << __FUNCTION__ <<
": Null: THE_TRANSACTION passed in!\n";
10884 const OTIdentifier theServerID(SERVER_ID), theUserID(USER_ID),
10885 theAccountID(ACCOUNT_ID);
10887 OTString strTransaction(THE_TRANSACTION);
10890 theUserID,
false, __FUNCTION__);
10891 if (
nullptr == pNym)
return "";
10894 OTTransaction theTransaction(theUserID, theAccountID, theServerID);
10898 otErr << __FUNCTION__
10899 <<
": Error loading transaction from string. Acct ID: "
10900 << strAcctID <<
"\n";
10904 std::unique_ptr<OTTransaction> theTransAngel;
10907 int64_t lBoxType = 0;
10909 if (theTransaction.
Contains(
"nymboxRecord"))
10911 else if (theTransaction.
Contains(
"inboxRecord"))
10913 else if (theTransaction.
Contains(
"outboxRecord"))
10915 else if (theTransaction.
Contains(
"paymentInboxRecord"))
10917 else if (theTransaction.
Contains(
"recordBoxRecord"))
10919 else if (theTransaction.
Contains(
"expiredBoxRecord"))
10922 otErr << __FUNCTION__ <<
": Error loading from abbreviated "
10923 "transaction: unknown ledger type. \n";
10928 if (
nullptr == pTransaction) {
10929 otErr << __FUNCTION__ <<
": Error loading from abbreviated "
10930 "transaction: failed loading box receipt.";
10933 theTransAngel.reset(pTransaction);
10936 pTransaction = &theTransaction;
10964 if (!strOutput.
Exists())
return "";
10968 std::string pBuf = strOutput.
Get();
10977 const std::string& SERVER_ID,
const std::string& USER_ID,
10978 const std::string& ACCOUNT_ID,
const std::string& THE_TRANSACTION)
const
10980 if (SERVER_ID.empty()) {
10981 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
10984 if (USER_ID.empty()) {
10985 otErr << __FUNCTION__ <<
": Null: USER_ID passed in!\n";
10988 if (ACCOUNT_ID.empty()) {
10989 otErr << __FUNCTION__ <<
": Null: ACCOUNT_ID passed in!\n";
10992 if (THE_TRANSACTION.empty()) {
10993 otErr << __FUNCTION__ <<
": Null: THE_TRANSACTION passed in!\n";
10997 const OTIdentifier theServerID(SERVER_ID), theUserID(USER_ID),
10998 theAccountID(ACCOUNT_ID);
11000 OTString strTransaction(THE_TRANSACTION);
11003 theUserID,
false, __FUNCTION__);
11004 if (
nullptr == pNym)
return "";
11006 OTTransaction theTransaction(theUserID, theAccountID, theServerID);
11010 otErr << __FUNCTION__
11011 <<
": Error loading transaction from string. Acct ID: "
11012 << strAcctID <<
"\n";
11016 std::unique_ptr<OTTransaction> theTransAngel;
11019 int64_t lBoxType = 0;
11021 if (theTransaction.
Contains(
"nymboxRecord"))
11023 else if (theTransaction.
Contains(
"inboxRecord"))
11025 else if (theTransaction.
Contains(
"outboxRecord"))
11027 else if (theTransaction.
Contains(
"paymentInboxRecord"))
11029 else if (theTransaction.
Contains(
"recordBoxRecord"))
11031 else if (theTransaction.
Contains(
"expiredBoxRecord"))
11034 otErr << __FUNCTION__ <<
": Error loading from abbreviated "
11035 "transaction: unknown ledger type.\n";
11040 if (
nullptr == pTransaction) {
11041 otErr << __FUNCTION__ <<
": Error loading from abbreviated "
11042 "transaction: failed loading box receipt. "
11046 theTransAngel.reset(pTransaction);
11049 pTransaction = &theTransaction;
11059 if (!strOutput.
Exists())
return "";
11063 std::string pBuf = strOutput.
Get();
11072 const std::string& SERVER_ID,
const std::string& USER_ID,
11073 const std::string& ACCOUNT_ID,
const std::string& THE_TRANSACTION)
const
11075 if (SERVER_ID.empty()) {
11076 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
11079 if (USER_ID.empty()) {
11080 otErr << __FUNCTION__ <<
": Null: USER_ID passed in!\n";
11083 if (ACCOUNT_ID.empty()) {
11084 otErr << __FUNCTION__ <<
": Null: ACCOUNT_ID passed in!\n";
11087 if (THE_TRANSACTION.empty()) {
11088 otErr << __FUNCTION__ <<
": Null: THE_TRANSACTION passed in!\n";
11092 const OTIdentifier theServerID(SERVER_ID), theUserID(USER_ID),
11093 theAccountID(ACCOUNT_ID);
11095 OTString strTransaction(THE_TRANSACTION);
11098 theUserID,
false, __FUNCTION__);
11099 if (
nullptr == pNym)
return "";
11101 OTTransaction theTransaction(theUserID, theAccountID, theServerID);
11105 otErr << __FUNCTION__ <<
": Error loading transaction from string in "
11106 "OTAPI_Exec::Transaction_GetRecipientAcctID. "
11107 "Acct ID: " << strAcctID <<
"\n";
11112 std::unique_ptr<OTTransaction> theTransAngel;
11115 int64_t lBoxType = 0;
11117 if (theTransaction.
Contains(
"nymboxRecord"))
11119 else if (theTransaction.
Contains(
"inboxRecord"))
11121 else if (theTransaction.
Contains(
"outboxRecord"))
11123 else if (theTransaction.
Contains(
"paymentInboxRecord"))
11125 else if (theTransaction.
Contains(
"recordBoxRecord"))
11127 else if (theTransaction.
Contains(
"expiredBoxRecord"))
11130 otErr << __FUNCTION__ <<
": Error loading from abbreviated "
11131 "transaction: unknown ledger type. \n";
11136 if (
nullptr == pTransaction) {
11137 otErr << __FUNCTION__ <<
": Error loading from abbreviated "
11138 "transaction: failed loading box "
11142 theTransAngel.reset(pTransaction);
11145 pTransaction = &theTransaction;
11154 if (!strOutput.
Exists())
return "";
11158 std::string pBuf = strOutput.
Get();
11176 const std::string& SERVER_ID,
const std::string& USER_ID,
11177 const std::string& ACCOUNT_ID,
const std::string& THE_TRANSACTION)
const
11179 if (SERVER_ID.empty()) {
11180 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
11183 if (USER_ID.empty()) {
11184 otErr << __FUNCTION__ <<
": Null: USER_ID passed in!\n";
11187 if (ACCOUNT_ID.empty()) {
11188 otErr << __FUNCTION__ <<
": Null: ACCOUNT_ID passed in!\n";
11191 if (THE_TRANSACTION.empty()) {
11192 otErr << __FUNCTION__ <<
": Null: THE_TRANSACTION passed in!\n";
11196 const OTIdentifier theServerID(SERVER_ID), theUserID(USER_ID),
11197 theAccountID(ACCOUNT_ID);
11199 OTString strTransaction(THE_TRANSACTION);
11201 theUserID,
false, __FUNCTION__);
11202 if (
nullptr == pNym)
return "";
11203 OTTransaction theTransaction(theUserID, theAccountID, theServerID);
11207 otErr << __FUNCTION__
11208 <<
": Error loading transaction from string. Acct ID: "
11209 << strAcctID <<
"\n";
11213 std::unique_ptr<OTTransaction> theTransAngel;
11216 int64_t lBoxType = 0;
11218 if (theTransaction.
Contains(
"nymboxRecord"))
11220 else if (theTransaction.
Contains(
"inboxRecord"))
11222 else if (theTransaction.
Contains(
"outboxRecord"))
11224 else if (theTransaction.
Contains(
"paymentInboxRecord"))
11226 else if (theTransaction.
Contains(
"recordBoxRecord"))
11228 else if (theTransaction.
Contains(
"expiredBoxRecord"))
11231 otErr << __FUNCTION__ <<
" Error loading from abbreviated "
11232 "transaction: unknown ledger type. \n";
11237 if (
nullptr == pTransaction) {
11238 otErr << __FUNCTION__ <<
": Error loading from abbreviated "
11239 "transaction: failed loading box receipt. "
11243 theTransAngel.reset(pTransaction);
11246 pTransaction = &theTransaction;
11248 otErr << __FUNCTION__
11249 <<
": wrong transaction type: " << pTransaction->
GetTypeString()
11250 <<
". (Expected \"pending\".)\n";
11256 if (!strReference.
Exists()) {
11257 otErr << __FUNCTION__
11258 <<
": No reference string found on transaction.\n";
11264 if (
nullptr == pItem) {
11265 otErr << __FUNCTION__
11266 <<
": Failed loading transaction item from string.\n";
11273 otErr << __FUNCTION__ <<
": Wrong item type or status attached as "
11274 "reference on transaction.\n";
11279 pItem->GetNote(strOutput);
11281 if (!strOutput.
Exists())
return "";
11285 std::string pBuf = strOutput.
Get();
11291 const std::string& SERVER_ID,
const std::string& USER_ID,
11292 const std::string& ACCOUNT_ID,
const std::string& THE_TRANSACTION)
const
11294 if (SERVER_ID.empty()) {
11295 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
11298 if (USER_ID.empty()) {
11299 otErr << __FUNCTION__ <<
": Null: USER_ID passed in!\n";
11302 if (ACCOUNT_ID.empty()) {
11303 otErr << __FUNCTION__ <<
": Null: ACCOUNT_ID passed in!\n";
11306 if (THE_TRANSACTION.empty()) {
11307 otErr << __FUNCTION__ <<
": Null: THE_TRANSACTION passed in!\n";
11311 const OTIdentifier theServerID(SERVER_ID), theUserID(USER_ID),
11312 theAccountID(ACCOUNT_ID);
11314 OTString strTransaction(THE_TRANSACTION);
11317 theUserID,
false, __FUNCTION__);
11320 OTTransaction theTransaction(theUserID, theAccountID, theServerID);
11324 otErr << __FUNCTION__
11325 <<
": Error loading transaction from string. Acct ID: "
11326 << strAcctID <<
"\n";
11331 std::unique_ptr<OTTransaction> theTransAngel;
11334 int64_t lBoxType = 0;
11336 if (theTransaction.
Contains(
"nymboxRecord"))
11338 else if (theTransaction.
Contains(
"inboxRecord"))
11340 else if (theTransaction.
Contains(
"outboxRecord"))
11342 else if (theTransaction.
Contains(
"paymentInboxRecord"))
11344 else if (theTransaction.
Contains(
"recordBoxRecord"))
11346 else if (theTransaction.
Contains(
"expiredBoxRecord"))
11349 otErr << __FUNCTION__ <<
": Error loading from abbreviated "
11350 "transaction: unknown ledger type. \n";
11355 if (
nullptr == pTransaction) {
11356 otErr << __FUNCTION__ <<
": Error loading from abbreviated "
11357 "transaction: failed loading box receipt. "
11361 theTransAngel.reset(pTransaction);
11364 pTransaction = &theTransaction;
11381 const std::string& SERVER_ID,
const std::string& USER_ID,
11382 const std::string& ACCOUNT_ID,
const std::string& THE_TRANSACTION)
const
11384 if (SERVER_ID.empty()) {
11385 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
11388 if (USER_ID.empty()) {
11389 otErr << __FUNCTION__ <<
": Null: USER_ID passed in!\n";
11392 if (ACCOUNT_ID.empty()) {
11393 otErr << __FUNCTION__ <<
": Null: ACCOUNT_ID passed in!\n";
11396 if (THE_TRANSACTION.empty()) {
11397 otErr << __FUNCTION__ <<
": Null: THE_TRANSACTION passed in!\n";
11401 const OTIdentifier theServerID(SERVER_ID), theUserID(USER_ID),
11402 theAccountID(ACCOUNT_ID);
11404 OTString strTransaction(THE_TRANSACTION);
11407 theUserID,
false, __FUNCTION__);
11408 if (
nullptr == pNym)
return -1;
11410 OTTransaction theTransaction(theUserID, theAccountID, theServerID);
11414 otErr << __FUNCTION__
11415 <<
": Error loading transaction from string. Acct ID: "
11416 << strAcctID <<
"\n";
11424 return lDisplayNum;
11431 const std::string& SERVER_ID,
const std::string& USER_ID,
11432 const std::string& ACCOUNT_ID,
const std::string& THE_TRANSACTION)
const
11434 if (SERVER_ID.empty()) {
11435 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
11438 if (USER_ID.empty()) {
11439 otErr << __FUNCTION__ <<
": Null: USER_ID passed in!\n";
11442 if (ACCOUNT_ID.empty()) {
11443 otErr << __FUNCTION__ <<
": Null: ACCOUNT_ID passed in!\n";
11446 if (THE_TRANSACTION.empty()) {
11447 otErr << __FUNCTION__ <<
": Null: THE_TRANSACTION passed in!\n";
11451 const OTIdentifier theServerID(SERVER_ID), theUserID(USER_ID),
11452 theAccountID(ACCOUNT_ID);
11454 OTString strTransaction(THE_TRANSACTION);
11457 theUserID,
false, __FUNCTION__);
11458 if (
nullptr == pNym)
return "";
11459 OTTransaction theTransaction(theUserID, theAccountID, theServerID);
11463 otErr << __FUNCTION__
11464 <<
": Error loading transaction from string. Acct ID: "
11465 << strAcctID <<
"\n";
11487 const std::string& SERVER_ID,
const std::string& USER_ID,
11488 const std::string& THE_TRANSACTION)
const
11490 if (SERVER_ID.empty()) {
11491 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
11494 if (USER_ID.empty()) {
11495 otErr << __FUNCTION__ <<
": Null: USER_ID passed in!\n";
11498 if (THE_TRANSACTION.empty()) {
11499 otErr << __FUNCTION__ <<
": Null: THE_TRANSACTION passed in!\n";
11503 const OTIdentifier theServerID(SERVER_ID), theUserID(USER_ID),
11504 theAccountID(USER_ID);
11507 OTString strTransaction(THE_TRANSACTION);
11510 theUserID,
false, __FUNCTION__);
11511 if (
nullptr == pNym)
return -1;
11513 OTTransaction theTransaction(theUserID, theAccountID, theServerID);
11517 otErr << __FUNCTION__
11518 <<
": Error loading transaction from string. User ID: "
11519 << strUserID <<
"\n";
11525 otErr << __FUNCTION__ <<
": Unexpected transaction type: "
11527 <<
". (Expected: replyNotice) User: " << strUserID <<
"\n";
11532 const int64_t lRequestNumber = theTransaction.
GetRequestNum();
11534 return lRequestNumber;
11542 const std::string& SERVER_ID,
const std::string& USER_ID,
11543 const std::string& ACCOUNT_ID,
const std::string& THE_TRANSACTION)
const
11545 if (SERVER_ID.empty()) {
11546 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
11549 if (USER_ID.empty()) {
11550 otErr << __FUNCTION__ <<
": Null: USER_ID passed in!\n";
11553 if (ACCOUNT_ID.empty()) {
11554 otErr << __FUNCTION__ <<
": Null: ACCOUNT_ID passed in!\n";
11557 if (THE_TRANSACTION.empty()) {
11558 otErr << __FUNCTION__ <<
": Null: THE_TRANSACTION passed in!\n";
11562 const OTIdentifier theServerID(SERVER_ID), theUserID(USER_ID),
11563 theAccountID(ACCOUNT_ID);
11565 OTString strTransaction(THE_TRANSACTION);
11568 theUserID,
false, __FUNCTION__);
11571 OTTransaction theTransaction(theUserID, theAccountID, theServerID);
11575 otErr << __FUNCTION__
11576 <<
": Error loading transaction from string. Acct ID: "
11577 << strAcctID <<
"\n";
11597 const std::string& SERVER_ID,
const std::string& USER_ID,
11598 const std::string& ACCOUNT_ID,
const std::string& THE_TRANSACTION)
const
11600 if (SERVER_ID.empty()) {
11601 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
11604 if (USER_ID.empty()) {
11605 otErr << __FUNCTION__ <<
": Null: USER_ID passed in!\n";
11608 if (ACCOUNT_ID.empty()) {
11609 otErr << __FUNCTION__ <<
": Null: ACCOUNT_ID passed in!\n";
11612 if (THE_TRANSACTION.empty()) {
11613 otErr << __FUNCTION__ <<
": Null: THE_TRANSACTION passed in!\n";
11617 const OTIdentifier theServerID(SERVER_ID), theUserID(USER_ID),
11618 theAccountID(ACCOUNT_ID);
11620 OTString strTransaction(THE_TRANSACTION);
11622 theUserID,
false, __FUNCTION__);
11623 if (
nullptr == pNym)
return OT_ERROR;
11626 OTTransaction theTransaction(theUserID, theAccountID, theServerID);
11630 otErr << __FUNCTION__
11631 <<
": Error loading transaction from string. Acct ID: "
11632 << strAcctID <<
"\n";
11636 std::unique_ptr<OTTransaction> theTransAngel;
11640 int64_t lBoxType = 0;
11642 if (theTransaction.
Contains(
"nymboxRecord"))
11644 else if (theTransaction.
Contains(
"inboxRecord"))
11646 else if (theTransaction.
Contains(
"outboxRecord"))
11648 else if (theTransaction.
Contains(
"paymentInboxRecord"))
11650 else if (theTransaction.
Contains(
"recordBoxRecord"))
11652 else if (theTransaction.
Contains(
"expiredBoxRecord"))
11655 otErr << __FUNCTION__ <<
": Error loading from abbreviated "
11656 "transaction: unknown ledger type. \n";
11661 if (
nullptr == pTransaction) {
11662 otErr << __FUNCTION__ <<
": Error loading from abbreviated "
11663 "transaction: failed loading box receipt. "
11667 theTransAngel.reset(pTransaction);
11670 pTransaction = &theTransaction;
11678 otErr << __FUNCTION__
11679 <<
": ** FYI, this transaction has a 'failure' status from the "
11680 "server. TransNum: " << lTransactionNum <<
"\n";
11687 const std::string& SERVER_ID,
const std::string& USER_ID,
11688 const std::string& ACCOUNT_ID,
const std::string& THE_TRANSACTION)
const
11690 if (SERVER_ID.empty()) {
11691 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
11694 if (USER_ID.empty()) {
11695 otErr << __FUNCTION__ <<
": Null: USER_ID passed in!\n";
11698 if (ACCOUNT_ID.empty()) {
11699 otErr << __FUNCTION__ <<
": Null: ACCOUNT_ID passed in!\n";
11702 if (THE_TRANSACTION.empty()) {
11703 otErr << __FUNCTION__ <<
": Null: THE_TRANSACTION passed in!\n";
11707 const OTIdentifier theServerID(SERVER_ID), theUserID(USER_ID),
11708 theAccountID(ACCOUNT_ID);
11710 OTString strTransaction(THE_TRANSACTION);
11712 theUserID,
false, __FUNCTION__);
11713 if (
nullptr == pNym)
return OT_ERROR;
11716 OTTransaction theTransaction(theUserID, theAccountID, theServerID);
11720 otErr << __FUNCTION__
11721 <<
": Error loading transaction from string. Acct ID: "
11722 << strAcctID <<
"\n";
11726 std::unique_ptr<OTTransaction> theTransAngel;
11745 int64_t lBoxType = 0;
11747 if (theTransaction.
Contains(
"nymboxRecord"))
11749 else if (theTransaction.
Contains(
"inboxRecord"))
11751 else if (theTransaction.
Contains(
"outboxRecord"))
11753 else if (theTransaction.
Contains(
"paymentInboxRecord"))
11755 else if (theTransaction.
Contains(
"recordBoxRecord"))
11757 else if (theTransaction.
Contains(
"expiredBoxRecord"))
11760 otErr << __FUNCTION__ <<
": Error loading from abbreviated "
11761 "transaction: unknown ledger type. \n";
11766 if (
nullptr == pTransaction) {
11767 otErr << __FUNCTION__ <<
": Error loading from abbreviated "
11768 "transaction: failed loading box receipt. "
11772 theTransAngel.reset(pTransaction);
11775 pTransaction = &theTransaction;
11791 const std::string& SERVER_ID,
const std::string& USER_ID,
11792 const std::string& ACCOUNT_ID,
const std::string& THE_TRANSACTION)
const
11794 if (SERVER_ID.empty()) {
11795 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
11798 if (USER_ID.empty()) {
11799 otErr << __FUNCTION__ <<
": Null: USER_ID passed in!\n";
11802 if (ACCOUNT_ID.empty()) {
11803 otErr << __FUNCTION__ <<
": Null: ACCOUNT_ID passed in!\n";
11806 if (THE_TRANSACTION.empty()) {
11807 otErr << __FUNCTION__ <<
": Null: THE_TRANSACTION passed in!\n";
11811 const OTIdentifier theServerID(SERVER_ID), theUserID(USER_ID),
11812 theAccountID(ACCOUNT_ID);
11814 OTString strTransaction(THE_TRANSACTION);
11817 theUserID,
false, __FUNCTION__);
11818 if (
nullptr == pNym)
return OT_ERROR;
11821 OTTransaction theTransaction(theUserID, theAccountID, theServerID);
11825 otErr << __FUNCTION__
11826 <<
": Error loading transaction from string. Acct ID: "
11827 << strAcctID <<
"\n";
11831 std::unique_ptr<OTTransaction> theTransAngel;
11837 int64_t lBoxType = 0;
11839 if (theTransaction.
Contains(
"nymboxRecord"))
11841 else if (theTransaction.
Contains(
"inboxRecord"))
11843 else if (theTransaction.
Contains(
"outboxRecord"))
11845 else if (theTransaction.
Contains(
"paymentInboxRecord"))
11847 else if (theTransaction.
Contains(
"recordBoxRecord"))
11849 else if (theTransaction.
Contains(
"expiredBoxRecord"))
11852 otErr << __FUNCTION__ <<
": Error loading from abbreviated "
11853 "transaction: unknown ledger type. \n";
11858 if (
nullptr == pTransaction) {
11859 otErr << __FUNCTION__ <<
": Error loading from abbreviated "
11860 "transaction: failed loading box "
11864 theTransAngel.reset(pTransaction);
11867 pTransaction = &theTransaction;
11872 if (
nullptr == pReplyItem)
11875 if (
nullptr == pReplyItem) {
11876 otErr << __FUNCTION__ <<
": good transaction (could have been "
11877 "abbreviated though) but uncovered \"\" item "
11892 const std::string& SERVER_ID,
const std::string& USER_ID,
11893 const std::string& ACCOUNT_ID,
const std::string& THE_MESSAGE)
const
11895 if (SERVER_ID.empty()) {
11896 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
11899 if (USER_ID.empty()) {
11900 otErr << __FUNCTION__ <<
": Null: USER_ID passed in!\n";
11903 if (ACCOUNT_ID.empty()) {
11904 otErr << __FUNCTION__ <<
": Null: ACCOUNT_ID passed in!\n";
11907 if (THE_MESSAGE.empty()) {
11908 otErr << __FUNCTION__ <<
": Null: THE_MESSAGE passed in!\n";
11912 const OTIdentifier theServerID(SERVER_ID), theUserID(USER_ID),
11913 theAccountID(ACCOUNT_ID);
11919 if (!strMessage.
Exists() ||
11921 otOut << __FUNCTION__ <<
": Unable to load message.\n";
11932 otOut << __FUNCTION__
11933 <<
": Wrong message type: " << theMessage.
m_strCommand <<
"\n";
11940 if (!strLedger.
Exists()) {
11941 otOut << __FUNCTION__ <<
": No ledger found on message.\n";
11945 OTLedger theLedger(theUserID, theAccountID, theServerID);
11949 otErr << __FUNCTION__
11950 <<
": Error loading ledger from string. Acct ID: " << strAcctID
11958 otErr << __FUNCTION__ <<
" bad count in message ledger: "
11969 if (
nullptr == pReplyTransaction) {
11970 otErr << __FUNCTION__
11971 <<
" good index but uncovered \"\" pointer there: " << 0 <<
"\n";
11979 if (
nullptr == pReplyItem)
11982 if (
nullptr == pReplyItem) {
11983 otErr << __FUNCTION__
11984 <<
" good index but uncovered \"\" item pointer: " << 0 <<
"\n";
12045 const std::string& ASSET_TYPE_ID,
12046 const std::string& USER_ID,
12047 const std::string& THE_PURSE)
const
12049 if (SERVER_ID.empty()) {
12050 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
12053 if (ASSET_TYPE_ID.empty()) {
12054 otErr << __FUNCTION__ <<
": Null: ASSET_TYPE_ID passed in!\n";
12057 if (USER_ID.empty()) {
12058 otErr << __FUNCTION__ <<
": Null: USER_ID passed in!\n";
12061 if (THE_PURSE.empty()) {
12062 otErr << __FUNCTION__ <<
": Null: THE_PURSE passed in!\n";
12066 std::string strFunc = __FUNCTION__;
12067 const OTIdentifier theServerID(SERVER_ID), theAssetTypeID(ASSET_TYPE_ID),
12068 theUserID(USER_ID);
12069 const OTString strPurse(THE_PURSE);
12070 bool bSuccess =
false;
12071 Purse thePurse(theServerID, theAssetTypeID, theUserID);
12085 if (OTAPI()->SavePurse(theServerID, theAssetTypeID, theUserID,
12090 otOut << strFunc <<
": Failure saving purse:\n" << strPurse <<
"\n";
12094 otOut << strFunc <<
": Failure loading purse from string:\n" << strPurse
12107 const std::string& ASSET_TYPE_ID,
12108 const std::string& USER_ID)
const
12112 if (SERVER_ID.empty()) {
12113 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
12116 if (ASSET_TYPE_ID.empty()) {
12117 otErr << __FUNCTION__ <<
": Null: ASSET_TYPE_ID passed in!\n";
12120 if (USER_ID.empty()) {
12121 otErr << __FUNCTION__ <<
": Null: USER_ID passed in!\n";
12130 std::unique_ptr<Purse> pPurse(
12131 OTAPI()->LoadPurse(theServerID, theAssetID, theUserID));
12133 if (
nullptr == pPurse) {
12134 otInfo <<
"OTAPI_Exec::LoadPurse() received null when called "
12135 "OT_API::LoadPurse(). Server: " << SERVER_ID
12136 <<
" Asset Type: " << ASSET_TYPE_ID <<
"\n";
12141 std::string pBuf = strOutput.
Get();
12153 const std::string& ASSET_TYPE_ID,
12154 const std::string& THE_PURSE)
const
12156 if (SERVER_ID.empty()) {
12157 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
12160 if (ASSET_TYPE_ID.empty()) {
12161 otErr << __FUNCTION__ <<
": Null: ASSET_TYPE_ID passed in!\n";
12164 if (THE_PURSE.empty()) {
12165 otErr << __FUNCTION__ <<
": Null: THE_PURSE passed in!\n";
12168 const OTIdentifier theServerID(SERVER_ID), theAssetTypeID(ASSET_TYPE_ID);
12170 Purse thePurse(theServerID, theAssetTypeID);
12173 OTString strAssetTypeID(theAssetTypeID);
12174 otErr << __FUNCTION__
12175 <<
": Error loading purse from string. Asset Type ID: "
12176 << strAssetTypeID <<
"\n";
12181 return lTotalValue > 0 ? lTotalValue : 0;
12188 const std::string& ASSET_TYPE_ID,
12189 const std::string& THE_PURSE)
const
12191 if (SERVER_ID.empty()) {
12192 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
12195 if (ASSET_TYPE_ID.empty()) {
12196 otErr << __FUNCTION__ <<
": Null: ASSET_TYPE_ID passed in!\n";
12199 if (THE_PURSE.empty()) {
12200 otErr << __FUNCTION__ <<
": Null: THE_PURSE passed in!\n";
12204 const OTIdentifier theServerID(SERVER_ID), theAssetTypeID(ASSET_TYPE_ID);
12205 const OTString strPurse(THE_PURSE);
12206 Purse thePurse(theServerID, theAssetTypeID);
12210 (thePurse.
GetAssetID() == theAssetTypeID)) {
12211 return thePurse.
Count();
12222 const std::string& THE_PURSE)
const
12224 if (SERVER_ID.empty()) {
12225 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
12228 if (THE_PURSE.empty()) {
12229 otErr << __FUNCTION__ <<
": Null: THE_PURSE passed in!\n";
12234 const OTString strPurse(THE_PURSE);
12235 Purse thePurse(theServerID);
12248 const std::string& ASSET_TYPE_ID,
12249 const std::string& OWNER_ID,
12250 const std::string& SIGNER_ID)
const
12252 if (SERVER_ID.empty()) {
12253 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
12256 if (ASSET_TYPE_ID.empty()) {
12257 otErr << __FUNCTION__ <<
": Null: ASSET_TYPE_ID passed in!\n";
12260 if (OWNER_ID.empty()) {
12261 otErr << __FUNCTION__ <<
": Null: OWNER_ID passed in!\n";
12264 if (SIGNER_ID.empty()) {
12265 otErr << __FUNCTION__ <<
": Null: SIGNER_ID passed in!\n";
12269 std::string strFunc = __FUNCTION__;
12271 const OTIdentifier theServerID(SERVER_ID), theAssetTypeID(ASSET_TYPE_ID),
12272 theOwnerID(OWNER_ID), theSignerID(SIGNER_ID);
12274 "Creating a cash purse. Enter wallet master password.");
12277 if (
nullptr == pOwnerNym)
return "";
12279 theSignerID,
false, strFunc.c_str(),
12281 if (
nullptr == pSignerNym)
return "";
12284 std::unique_ptr<Purse> pPurse(
12287 if (
nullptr != pPurse) {
12288 pPurse->SignContract(*pSignerNym, &thePWData);
12289 pPurse->SaveContract();
12290 const OTString strOutput(*pPurse);
12291 std::string pBuf = strOutput.
Get();
12308 const std::string& SERVER_ID,
const std::string& ASSET_TYPE_ID,
12309 const std::string& SIGNER_ID)
const
12311 if (SERVER_ID.empty()) {
12312 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
12315 if (ASSET_TYPE_ID.empty()) {
12316 otErr << __FUNCTION__ <<
": Null: ASSET_TYPE_ID passed in!\n";
12319 if (SIGNER_ID.empty()) {
12320 otErr << __FUNCTION__ <<
": Null: SIGNER_ID passed in!\n";
12323 const OTIdentifier theServerID(SERVER_ID), theAssetTypeID(ASSET_TYPE_ID),
12324 theSignerID(SIGNER_ID);
12325 OTPasswordData thePWData(
"Creating a password-protected cash purse.");
12327 theSignerID,
false, __FUNCTION__,
12329 if (
nullptr == pNym)
return "";
12332 std::unique_ptr<Purse> pPurse(
12335 if (
nullptr != pPurse) {
12336 pPurse->SignContract(*pNym, &thePWData);
12337 pPurse->SaveContract();
12338 const OTString strOutput(*pPurse);
12339 std::string pBuf = strOutput.
Get();
12356 const std::string& SERVER_ID,
const std::string& ASSET_TYPE_ID,
12357 const std::string& OWNER_ID,
12361 const std::string& THE_PURSE)
const
12365 if (SERVER_ID.empty()) {
12366 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
12369 if (ASSET_TYPE_ID.empty()) {
12370 otErr << __FUNCTION__ <<
": Null: ASSET_TYPE_ID passed in!\n";
12376 if (THE_PURSE.empty()) {
12377 otErr << __FUNCTION__ <<
": Null: THE_PURSE passed in!\n";
12381 std::string strFunc = __FUNCTION__;
12383 const bool& bDoesOwnerIDExist =
12384 ((
"" != OWNER_ID) && (
'\0' != OWNER_ID[0]));
12389 if (bDoesOwnerIDExist) {
12390 const OTString strOwnerID(OWNER_ID);
12392 if (strOwnerID.
Exists()) {
12395 theOwnerID,
false, strFunc.c_str(),
12398 if (
nullptr == pNym)
return "";
12402 const OTIdentifier theServerID(SERVER_ID), theAssetTypeID(ASSET_TYPE_ID);
12403 const OTString strPurse(THE_PURSE);
12405 theServerID, theAssetTypeID, strPurse,
12406 bDoesOwnerIDExist ? &theOwnerID :
nullptr,
nullptr));
12407 if (
nullptr != pToken) {
12408 pToken->SaveContractRaw(strOutput);
12410 std::string pBuf = strOutput.
Get();
12415 otOut << strFunc <<
": Failed peeking at a token on a cash purse.\n";
12428 const std::string& SERVER_ID,
const std::string& ASSET_TYPE_ID,
12429 const std::string& OWNER_OR_SIGNER_ID,
12443 const std::string& THE_PURSE)
const
12447 if (SERVER_ID.empty()) {
12448 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
12451 if (ASSET_TYPE_ID.empty()) {
12452 otErr << __FUNCTION__ <<
": Null: ASSET_TYPE_ID passed in!\n";
12455 if (OWNER_OR_SIGNER_ID.empty()) {
12456 otErr << __FUNCTION__ <<
": Null: OWNER_OR_SIGNER_ID passed in!\n";
12459 if (THE_PURSE.empty()) {
12460 otErr << __FUNCTION__ <<
": Null: THE_PURSE passed in!\n";
12464 std::string strFunc = __FUNCTION__;
12465 const OTString strReason(
"Popping a token off of a cash purse.");
12467 const OTIdentifier theServerID(SERVER_ID), theAssetTypeID(ASSET_TYPE_ID),
12468 theNymID(OWNER_OR_SIGNER_ID);
12469 const OTString strPurse(THE_PURSE);
12471 theNymID,
false, strFunc.c_str(),
12473 if (
nullptr == pNym)
return "";
12477 theServerID, theAssetTypeID, strPurse,
12481 if (
nullptr != pPurse) {
12482 pPurse->ReleaseSignatures();
12483 pPurse->SignContract(*pNym, &thePWData);
12484 pPurse->SaveContract();
12486 pPurse->SaveContractRaw(strOutput);
12487 std::string pBuf = strOutput.
Get();
12492 otOut << strFunc <<
": Failed popping a token off of a cash purse.\n";
12546 const std::string& ASSET_TYPE_ID,
12547 const std::string& SIGNER_ID,
12548 const std::string& THE_PURSE)
const
12552 if (SERVER_ID.empty()) {
12553 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
12556 if (ASSET_TYPE_ID.empty()) {
12557 otErr << __FUNCTION__ <<
": Null: ASSET_TYPE_ID passed in!\n";
12560 if (SIGNER_ID.empty()) {
12561 otErr << __FUNCTION__ <<
": Null: SIGNER_ID passed in!\n";
12564 if (THE_PURSE.empty()) {
12565 otErr << __FUNCTION__ <<
": Null: THE_PURSE passed in!\n";
12569 std::string strFunc = __FUNCTION__;
12570 const OTString strReason(
"Creating an empty copy of a cash purse.");
12572 const OTIdentifier theServerID(SERVER_ID), theAssetTypeID(ASSET_TYPE_ID),
12573 theNymID(SIGNER_ID);
12574 const OTString strPurse(THE_PURSE);
12576 theNymID,
false, strFunc.c_str(),
12578 if (
nullptr == pNym)
return "";
12582 theServerID, theAssetTypeID, strPurse, &strReason));
12583 if (
nullptr != pPurse) {
12584 pPurse->ReleaseSignatures();
12585 pPurse->SignContract(*pNym, &thePWData);
12586 pPurse->SaveContract();
12588 pPurse->SaveContractRaw(strOutput);
12589 std::string pBuf = strOutput.
Get();
12594 otOut << strFunc <<
": Failed emptying a cash purse.\n";
12605 const std::string& SERVER_ID,
const std::string& ASSET_TYPE_ID,
12606 const std::string& SIGNER_ID,
12613 const std::string& OWNER_ID,
12625 const std::string& THE_PURSE,
const std::string& THE_TOKEN)
const
12629 if (SERVER_ID.empty()) {
12630 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
12633 if (ASSET_TYPE_ID.empty()) {
12634 otErr << __FUNCTION__ <<
": Null: ASSET_TYPE_ID passed in!\n";
12637 if (SIGNER_ID.empty()) {
12638 otErr << __FUNCTION__ <<
": Null: SIGNER_ID passed in!\n";
12644 if (THE_PURSE.empty()) {
12645 otErr << __FUNCTION__ <<
": Null: THE_PURSE passed in!\n";
12648 if (THE_TOKEN.empty()) {
12649 otErr << __FUNCTION__ <<
": Null: THE_TOKEN passed in!\n";
12653 std::string strFunc = __FUNCTION__;
12654 const OTString strReason(
"Pushing a token onto a cash purse.");
12656 const bool& bDoesOwnerIDExist =
12657 ((
"" != OWNER_ID) && (
'\0' != OWNER_ID[0]));
12662 if (bDoesOwnerIDExist) {
12663 const OTString strOwnerID(OWNER_ID);
12665 if (strOwnerID.
Exists()) {
12668 theOwnerID,
false, strFunc.c_str(),
12671 if (
nullptr == pOwnerNym)
return "";
12675 const OTIdentifier theServerID(SERVER_ID), theAssetTypeID(ASSET_TYPE_ID);
12676 const OTString strPurse(THE_PURSE), strToken(THE_TOKEN);
12678 theServerID, theAssetTypeID, strPurse, strToken,
12679 bDoesOwnerIDExist ? &theOwnerID :
nullptr,
12683 if (
nullptr != pPurse) {
12686 theSignerID,
false, strFunc.c_str(),
12688 if (
nullptr == pSignerNym)
return "";
12691 pPurse->ReleaseSignatures();
12692 pPurse->SignContract(*pSignerNym, &thePWData);
12693 pPurse->SaveContract();
12695 pPurse->SaveContractRaw(strOutput);
12696 std::string pBuf = strOutput.
Get();
12701 otOut << strFunc <<
": Failed pushing a token onto a cash purse.\n";
12711 const std::string& ASSET_TYPE_ID,
12712 const std::string& USER_ID,
12713 const std::string& THE_PURSE)
const
12715 if (SERVER_ID.empty()) {
12716 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
12719 if (ASSET_TYPE_ID.empty()) {
12720 otErr << __FUNCTION__ <<
": Null: ASSET_TYPE_ID passed in!\n";
12723 if (USER_ID.empty()) {
12724 otErr << __FUNCTION__ <<
": Null: USER_ID passed in!\n";
12727 if (THE_PURSE.empty()) {
12728 otErr << __FUNCTION__ <<
": Null: THE_PURSE passed in!\n";
12732 OTString strReason(
"Importing a cash purse into the wallet.");
12734 const OTIdentifier theServerID(SERVER_ID), theAssetTypeID(ASSET_TYPE_ID),
12735 theUserID(USER_ID);
12736 const OTString strNewPurse(THE_PURSE);
12745 theServerID, theAssetTypeID, theUserID, strNewPurse, &strDisplay);
12746 return bImported ?
true :
false;
12779 const std::string& ASSET_TYPE_ID,
12780 const std::string& USER_ID,
12781 const std::string& THE_PURSE)
const
12783 if (SERVER_ID.empty()) {
12784 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
12787 if (ASSET_TYPE_ID.empty()) {
12788 otErr << __FUNCTION__ <<
": Null: ASSET_TYPE_ID passed in!\n";
12791 if (USER_ID.empty()) {
12792 otErr << __FUNCTION__ <<
": Null: USER_ID passed in!\n";
12795 if (THE_PURSE.empty()) {
12796 otErr << __FUNCTION__ <<
": Null: THE_PURSE passed in!\n";
12801 otErr << __FUNCTION__
12802 <<
": TODO (NOT CODED YET) OTAPI_Exec::exchangePurse: SERVER_ID: "
12803 << SERVER_ID <<
"\n ASSET_TYPE_ID: " << ASSET_TYPE_ID
12804 <<
"\n USER_ID: " << USER_ID <<
"\n ";
12838 const std::string& SERVER_ID,
const std::string& ASSET_TYPE_ID,
12839 const std::string& THE_TOKEN,
const std::string& SIGNER_NYM_ID,
12840 const std::string& OLD_OWNER,
12841 const std::string& NEW_OWNER)
const
12843 if (SERVER_ID.empty()) {
12844 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
12847 if (ASSET_TYPE_ID.empty()) {
12848 otErr << __FUNCTION__ <<
": Null: ASSET_TYPE_ID passed in!\n";
12851 if (THE_TOKEN.empty()) {
12852 otErr << __FUNCTION__ <<
": Null: THE_TOKEN passed in!\n";
12855 if (SIGNER_NYM_ID.empty()) {
12856 otErr << __FUNCTION__ <<
": Null: SIGNER_NYM_ID passed in!\n";
12859 if (OLD_OWNER.empty()) {
12860 otErr << __FUNCTION__ <<
": Null: OLD_OWNER passed in!\n";
12863 if (NEW_OWNER.empty()) {
12864 otErr << __FUNCTION__ <<
": Null: NEW_OWNER passed in!\n";
12868 const OTIdentifier theServerID(SERVER_ID), theAssetTypeID(ASSET_TYPE_ID),
12869 theSignerNymID(SIGNER_NYM_ID);
12870 const OTString strOldOwner(OLD_OWNER),
12873 strNewOwner(NEW_OWNER);
12878 std::unique_ptr<Token> pToken(OTAPI()->Token_ChangeOwner(
12879 theServerID, theAssetTypeID, strToken, theSignerNymID,
12886 if (
nullptr != pToken)
12888 const OTString strOutput(*pToken);
12890 std::string pBuf = strOutput.
Get();
12905 const std::string& ASSET_TYPE_ID,
12906 const std::string& THE_TOKEN)
const
12908 if (SERVER_ID.empty()) {
12909 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
12912 if (ASSET_TYPE_ID.empty()) {
12913 otErr << __FUNCTION__ <<
": Null: ASSET_TYPE_ID passed in!\n";
12916 if (THE_TOKEN.empty()) {
12917 otErr << __FUNCTION__ <<
": Null: THE_TOKEN passed in!\n";
12921 const OTIdentifier theServerID(SERVER_ID), theAssetTypeID(ASSET_TYPE_ID);
12926 std::unique_ptr<Token> pToken(
12929 if (
nullptr != pToken)
12932 pToken->GetSpendable();
12935 strOutput.
Format(
"%s", ascSpendable.
Get());
12938 std::string pBuf = strOutput.
Get();
12946 const std::string& ASSET_TYPE_ID,
12947 const std::string& THE_TOKEN)
const
12949 if (SERVER_ID.empty()) {
12950 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
12953 if (ASSET_TYPE_ID.empty()) {
12954 otErr << __FUNCTION__ <<
": Null: ASSET_TYPE_ID passed in!\n";
12957 if (THE_TOKEN.empty()) {
12958 otErr << __FUNCTION__ <<
": Null: THE_TOKEN passed in!\n";
12962 const OTIdentifier theServerID(SERVER_ID), theAssetTypeID(ASSET_TYPE_ID);
12967 std::unique_ptr<Token> pToken(
12970 if (
nullptr != pToken)
12972 return pToken->GetDenomination();
12983 const std::string& ASSET_TYPE_ID,
12984 const std::string& THE_TOKEN)
const
12986 if (SERVER_ID.empty()) {
12987 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
12990 if (ASSET_TYPE_ID.empty()) {
12991 otErr << __FUNCTION__ <<
": Null: ASSET_TYPE_ID passed in!\n";
12994 if (THE_TOKEN.empty()) {
12995 otErr << __FUNCTION__ <<
": Null: THE_TOKEN passed in!\n";
12999 const OTIdentifier theServerID(SERVER_ID), theAssetTypeID(ASSET_TYPE_ID);
13004 std::unique_ptr<Token> pToken(
13007 if (
nullptr != pToken)
13008 return pToken->GetSeries();
13016 const std::string& ASSET_TYPE_ID,
13017 const std::string& THE_TOKEN)
const
13019 if (SERVER_ID.empty()) {
13020 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
13023 if (ASSET_TYPE_ID.empty()) {
13024 otErr << __FUNCTION__ <<
": Null: ASSET_TYPE_ID passed in!\n";
13027 if (THE_TOKEN.empty()) {
13028 otErr << __FUNCTION__ <<
": Null: THE_TOKEN passed in!\n";
13032 const OTIdentifier theServerID(SERVER_ID), theAssetTypeID(ASSET_TYPE_ID);
13037 std::unique_ptr<Token> pToken(
13040 if (
nullptr != pToken)
13042 return pToken->GetValidFrom();
13050 const std::string& ASSET_TYPE_ID,
13051 const std::string& THE_TOKEN)
const
13053 if (SERVER_ID.empty()) {
13054 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
13057 if (ASSET_TYPE_ID.empty()) {
13058 otErr << __FUNCTION__ <<
": Null: ASSET_TYPE_ID passed in!\n";
13061 if (THE_TOKEN.empty()) {
13062 otErr << __FUNCTION__ <<
": Null: THE_TOKEN passed in!\n";
13066 const OTIdentifier theServerID(SERVER_ID), theAssetTypeID(ASSET_TYPE_ID);
13071 std::unique_ptr<Token> pToken(
13074 if (
nullptr != pToken)
13076 return pToken->GetValidTo();
13083 if (THE_TOKEN.empty()) {
13084 otErr << __FUNCTION__ <<
": Null: THE_TOKEN passed in!\n";
13093 if (
nullptr != pToken)
13099 std::string pBuf = strOutput.
Get();
13106 if (THE_TOKEN.empty()) {
13107 otErr << __FUNCTION__ <<
": Null: THE_TOKEN passed in!\n";
13116 if (
nullptr != pToken)
13122 std::string pBuf = strOutput.
Get();
13135 if (ASSET_TYPE_ID.empty()) {
13136 otErr << __FUNCTION__ <<
": Null: ASSET_TYPE_ID passed in!\n";
13154 const std::string& ASSET_TYPE_ID)
const
13156 if (ASSET_TYPE_ID.empty()) {
13157 otErr << __FUNCTION__ <<
": Null: ASSET_TYPE_ID passed in!\n";
13171 const std::string& BASKET_ASSET_TYPE_ID,
const int32_t& nIndex)
const
13173 if (BASKET_ASSET_TYPE_ID.empty()) {
13174 otErr << __FUNCTION__ <<
": Null: BASKET_ASSET_TYPE_ID passed in!\n";
13179 otErr << __FUNCTION__
13180 <<
": nIndex is out of bounds (it's in the negative!)\n";
13184 const OTIdentifier theAssetTypeID(BASKET_ASSET_TYPE_ID);
13189 theOutputMemberType);
13190 if (!bGotType)
return "";
13192 OTString strOutput(theOutputMemberType);
13194 std::string pBuf = strOutput.
Get();
13210 const std::string& BASKET_ASSET_TYPE_ID)
const
13212 if (BASKET_ASSET_TYPE_ID.empty()) {
13213 otErr << __FUNCTION__ <<
": Null: BASKET_ASSET_TYPE_ID passed in!\n";
13217 const OTIdentifier theAssetTypeID(BASKET_ASSET_TYPE_ID);
13219 int64_t lMinTransAmount =
13222 if (0 >= lMinTransAmount) {
13225 <<
": returned 0 (or negitive). Strange... what basket is this?\n";
13229 return lMinTransAmount;
13245 const std::string& BASKET_ASSET_TYPE_ID,
const int32_t& nIndex)
const
13247 if (BASKET_ASSET_TYPE_ID.empty()) {
13248 otErr << __FUNCTION__ <<
": Null: BASKET_ASSET_TYPE_ID passed in!\n";
13253 otErr << __FUNCTION__
13254 <<
": nIndex is out of bounds (it's in the negative!)\n";
13258 const OTIdentifier theAssetTypeID(BASKET_ASSET_TYPE_ID);
13260 int64_t lMinTransAmount =
13263 if (0 >= lMinTransAmount) {
13266 <<
": returned 0 (or negitive). Strange... what basket is this?\n";
13270 return lMinTransAmount;
13286 const std::string& USER_ID)
const
13288 if (SERVER_ID.empty()) {
13289 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
13292 if (USER_ID.empty()) {
13293 otErr << __FUNCTION__ <<
": Null: USER_ID passed in!\n";
13297 OTIdentifier theServerID(SERVER_ID), theUserID(USER_ID);
13313 const std::string& USER_ID)
const
13315 if (SERVER_ID.empty()) {
13316 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
13319 if (USER_ID.empty()) {
13320 otErr << __FUNCTION__ <<
": Null: USER_ID passed in!\n";
13324 OTIdentifier theServerID(SERVER_ID), theUserID(USER_ID);
13340 const std::string& USER_ID)
const
13342 if (SERVER_ID.empty()) {
13343 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
13346 if (USER_ID.empty()) {
13347 otErr << __FUNCTION__ <<
": Null: USER_ID passed in!\n";
13351 OTIdentifier theServerID(SERVER_ID), theUserID(USER_ID);
13378 const std::string& THE_MESSAGE)
const
13380 if (THE_MESSAGE.empty()) {
13381 otErr << __FUNCTION__ <<
": Null: THE_MESSAGE passed in!\n";
13388 if (!strMessage.
Exists()) {
13389 otErr << __FUNCTION__ <<
": Error: THE_MESSAGE doesn't exist.\n";
13394 otErr << __FUNCTION__ <<
": Failed loading message from string.\n";
13399 otErr << __FUNCTION__ <<
": Message success == false, thus unable to "
13400 "report Usage Credits balance. (Returning "
13406 otErr << __FUNCTION__ <<
": THE_MESSAGE is supposed to be of command "
13407 "type \"@usageCredits\", but instead it's a: "
13408 << theMessage.
m_strCommand <<
"\n (Failure. Returning -2.)";
13431 const std::string& USER_ID,
13432 const std::string& USER_ID_CHECK,
13433 const int64_t& ADJUSTMENT)
const
13441 if (SERVER_ID.empty()) {
13442 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
13445 if (USER_ID.empty()) {
13446 otErr << __FUNCTION__ <<
": Null: USER_ID passed in!\n";
13449 if (USER_ID_CHECK.empty()) {
13450 otErr << __FUNCTION__ <<
": Null: USER_ID_CHECK passed in!\n";
13457 const OTIdentifier theServerID(SERVER_ID), theUserID(USER_ID),
13458 theOtherUserID(USER_ID_CHECK);
13460 const int64_t lAdjustment = ADJUSTMENT;
13462 return OTAPI()->usageCredits(theServerID, theUserID, theOtherUserID,
13463 static_cast<int64_t>(lAdjustment));
13477 const std::string& USER_ID,
13478 const std::string& USER_ID_CHECK)
const
13480 if (SERVER_ID.empty()) {
13481 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
13484 if (USER_ID.empty()) {
13485 otErr << __FUNCTION__ <<
": Null: USER_ID passed in!\n";
13488 if (USER_ID_CHECK.empty()) {
13489 otErr << __FUNCTION__ <<
": Null: USER_ID_CHECK passed in!\n";
13493 OTIdentifier theServerID(SERVER_ID), theUserID(USER_ID),
13494 theOtherUserID(USER_ID_CHECK);
13496 return OTAPI()->
checkUser(theServerID, theUserID, theOtherUserID);
13510 const std::string& USER_ID,
13511 const std::string& USER_ID_RECIPIENT,
13512 const std::string& RECIPIENT_PUBKEY,
13513 const std::string& THE_MESSAGE)
const
13515 if (SERVER_ID.empty()) {
13516 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
13519 if (USER_ID.empty()) {
13520 otErr << __FUNCTION__ <<
": Null: USER_ID passed in!\n";
13523 if (USER_ID_RECIPIENT.empty()) {
13524 otErr << __FUNCTION__ <<
": Null: USER_ID_RECIPIENT passed in!\n";
13527 if (RECIPIENT_PUBKEY.empty()) {
13528 otErr << __FUNCTION__ <<
": Null: RECIPIENT_PUBKEY passed in!\n";
13531 if (THE_MESSAGE.empty()) {
13532 otErr << __FUNCTION__ <<
": Null: THE_MESSAGE passed in!\n";
13536 OTIdentifier theServerID(SERVER_ID), theUserID(USER_ID),
13537 theOtherUserID(USER_ID_RECIPIENT);
13538 OTString strRecipPubkey(RECIPIENT_PUBKEY);
13542 strRecipPubkey, strMessage);
13556 const std::string& SERVER_ID,
const std::string& USER_ID,
13557 const std::string& USER_ID_RECIPIENT,
const std::string& RECIPIENT_PUBKEY,
13558 const std::string& THE_INSTRUMENT,
13559 const std::string& INSTRUMENT_FOR_SENDER)
const
13570 if (SERVER_ID.empty()) {
13571 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
13574 if (USER_ID.empty()) {
13575 otErr << __FUNCTION__ <<
": Null: USER_ID passed in!\n";
13578 if (USER_ID_RECIPIENT.empty()) {
13579 otErr << __FUNCTION__ <<
": Null: USER_ID_RECIPIENT passed in!\n";
13582 if (RECIPIENT_PUBKEY.empty()) {
13583 otErr << __FUNCTION__ <<
": Null: RECIPIENT_PUBKEY passed in!\n";
13586 if (THE_INSTRUMENT.empty()) {
13587 otErr << __FUNCTION__ <<
": Null: THE_INSTRUMENT passed in!\n";
13595 OTIdentifier theServerID(SERVER_ID), theUserID(USER_ID),
13596 theOtherUserID(USER_ID_RECIPIENT);
13597 OTString strRecipPubkey(RECIPIENT_PUBKEY), strInstrument(THE_INSTRUMENT);
13623 otOut << __FUNCTION__ <<
": Failure loading payment instrument "
13624 "(intended for recipient) from string:\n\n"
13625 << strInstrument <<
"\n\n";
13628 const bool bSenderCopyIncluded = (INSTRUMENT_FOR_SENDER.size() > 0);
13630 if (bSenderCopyIncluded) {
13631 OTString strInstrumentForSender(INSTRUMENT_FOR_SENDER);
13632 OTPayment theSenderPayment(strInstrumentForSender);
13635 otOut << __FUNCTION__
13636 <<
": Failure loading payment instrument (copy intended for "
13637 "sender's records) from string:\n\n"
13638 << strInstrumentForSender <<
"\n\n";
13641 return OTAPI()->sendUserInstrument(theServerID, theUserID,
13642 theOtherUserID, strRecipPubkey,
13643 thePayment, &theSenderPayment);
13645 return OTAPI()->sendUserInstrument(theServerID, theUserID, theOtherUserID,
13646 strRecipPubkey, thePayment);
13655 const std::string& USER_ID)
const
13657 if (SERVER_ID.empty()) {
13658 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
13661 if (USER_ID.empty()) {
13662 otErr << __FUNCTION__ <<
": Null: USER_ID passed in!\n";
13666 OTIdentifier theServerID(SERVER_ID), theUserID(USER_ID);
13682 const std::string& USER_ID,
13683 const std::string& THE_CONTRACT)
const
13685 if (SERVER_ID.empty()) {
13686 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
13689 if (USER_ID.empty()) {
13690 otErr << __FUNCTION__ <<
": Null: USER_ID passed in!\n";
13693 if (THE_CONTRACT.empty()) {
13694 otErr << __FUNCTION__ <<
": Null: THE_CONTRACT passed in!\n";
13698 OTIdentifier theServerID(SERVER_ID), theUserID(USER_ID);
13700 OTString strContract(THE_CONTRACT);
13716 const std::string& USER_ID,
13717 const std::string& ASSET_ID)
const
13719 if (SERVER_ID.empty()) {
13720 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
13723 if (USER_ID.empty()) {
13724 otErr << __FUNCTION__ <<
": Null: USER_ID passed in!\n";
13727 if (ASSET_ID.empty()) {
13728 otErr << __FUNCTION__ <<
": Null: ASSET_ID passed in!\n";
13732 OTIdentifier theServerID(SERVER_ID), theUserID(USER_ID),
13733 theAssetID(ASSET_ID);
13749 const std::string& USER_ID,
13750 const std::string& ASSET_ID)
const
13752 if (SERVER_ID.empty()) {
13753 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
13756 if (USER_ID.empty()) {
13757 otErr << __FUNCTION__ <<
": Null: USER_ID passed in!\n";
13760 if (ASSET_ID.empty()) {
13761 otErr << __FUNCTION__ <<
": Null: ASSET_ID passed in!\n";
13765 OTIdentifier theServerID(SERVER_ID), theUserID(USER_ID),
13766 theAssetID(ASSET_ID);
13768 return OTAPI()->
getMint(theServerID, theUserID, theAssetID);
13782 const std::string& USER_ID,
13783 const std::string& ASSET_ID)
const
13785 if (SERVER_ID.empty()) {
13786 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
13789 if (USER_ID.empty()) {
13790 otErr << __FUNCTION__ <<
": Null: USER_ID passed in!\n";
13793 if (ASSET_ID.empty()) {
13794 otErr << __FUNCTION__ <<
": Null: ASSET_ID passed in!\n";
13798 OTIdentifier theServerID(SERVER_ID), theUserID(USER_ID),
13799 theAssetID(ASSET_ID);
13817 const std::string& USER_ID,
13818 const std::string& ACCT_ID)
const
13820 if (SERVER_ID.empty()) {
13821 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
13824 if (USER_ID.empty()) {
13825 otErr << __FUNCTION__ <<
": Null: USER_ID passed in!\n";
13828 if (ACCT_ID.empty()) {
13829 otErr << __FUNCTION__ <<
": Null: ACCT_ID passed in!\n";
13833 OTIdentifier theServerID(SERVER_ID), theUserID(USER_ID), theAcctID(ACCT_ID);
13850 const std::string& USER_ID,
13851 const std::string& ACCT_ID)
const
13853 if (SERVER_ID.empty()) {
13854 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
13857 if (USER_ID.empty()) {
13858 otErr << __FUNCTION__ <<
": Null: USER_ID passed in!\n";
13861 if (ACCT_ID.empty()) {
13862 otErr << __FUNCTION__ <<
": Null: ACCT_ID passed in!\n";
13866 OTIdentifier theServerID(SERVER_ID), theUserID(USER_ID), theAcctID(ACCT_ID);
13880 const std::string& USER_ID,
const int64_t& MINIMUM_TRANSFER)
const
13882 if (USER_ID.empty()) {
13883 otErr << __FUNCTION__ <<
": Null: USER_ID passed in!\n";
13886 if (0 > MINIMUM_TRANSFER) {
13887 otErr << __FUNCTION__ <<
": Negative: MINIMUM_TRANSFER passed in!\n";
13893 int64_t lMinimumTransfer = MINIMUM_TRANSFER == 0 ? 10 : MINIMUM_TRANSFER;
13896 theUserID, static_cast<int64_t>(lMinimumTransfer)));
13899 if (
nullptr == pBasket)
return "";
13908 std::string pBuf = strOutput.
Get();
13923 const std::string& USER_ID,
13924 const std::string& THE_BASKET,
13925 const std::string& ASSET_TYPE_ID,
13926 const int64_t& MINIMUM_TRANSFER)
const
13929 if (USER_ID.empty()) {
13930 otErr << __FUNCTION__ <<
": Null: USER_ID passed in!\n";
13933 if (THE_BASKET.empty()) {
13934 otErr << __FUNCTION__ <<
": Null: THE_BASKET passed in!\n";
13937 if (ASSET_TYPE_ID.empty()) {
13938 otErr << __FUNCTION__ <<
": Null: ASSET_TYPE_ID passed in!\n";
13941 if (0 > MINIMUM_TRANSFER) {
13942 otErr << __FUNCTION__ <<
": Negative: MINIMUM_TRANSFER passed in!\n";
13947 const OTIdentifier theUserID(USER_ID), theAssetTypeID(ASSET_TYPE_ID);
13948 int64_t lMinimumTransfer = MINIMUM_TRANSFER == 0 ? 10 : MINIMUM_TRANSFER;
13951 bool bAdded =
false;
13961 static_cast<int64_t>(lMinimumTransfer));
13966 if (!bAdded)
return "";
13969 std::string pBuf = strOutput.
Get();
13998 const std::string& USER_ID,
13999 const std::string& THE_BASKET)
const
14001 if (SERVER_ID.empty()) {
14002 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
14005 if (USER_ID.empty()) {
14006 otErr << __FUNCTION__ <<
": Null: USER_ID passed in!\n";
14009 if (THE_BASKET.empty()) {
14010 otErr << __FUNCTION__ <<
": Null: THE_BASKET passed in!\n";
14014 OTIdentifier theServerID(SERVER_ID), theUserID(USER_ID);
14016 OTString strBasketInfo(THE_BASKET);
14030 const std::string& SERVER_ID,
const std::string& USER_ID,
14031 const std::string& BASKET_ASSET_TYPE_ID,
14032 const std::string& BASKET_ASSET_ACCT_ID,
14033 const int32_t& TRANSFER_MULTIPLE)
const
14036 if (SERVER_ID.empty()) {
14037 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
14040 if (USER_ID.empty()) {
14041 otErr << __FUNCTION__ <<
": Null: USER_ID passed in!\n";
14044 if (BASKET_ASSET_TYPE_ID.empty()) {
14045 otErr << __FUNCTION__ <<
": Null: BASKET_ASSET_TYPE_ID passed in!\n";
14048 if (BASKET_ASSET_ACCT_ID.empty()) {
14049 otErr << __FUNCTION__ <<
": Null: BASKET_ASSET_ACCT_ID passed in!\n";
14053 const OTIdentifier theUserID(USER_ID), theServerID(SERVER_ID),
14054 theBasketAssetTypeID(BASKET_ASSET_TYPE_ID),
14055 theBasketAssetAcctID(BASKET_ASSET_ACCT_ID);
14056 int32_t nTransferMultiple = 1;
14058 if (TRANSFER_MULTIPLE > 0) nTransferMultiple = TRANSFER_MULTIPLE;
14059 std::unique_ptr<Basket> pBasket(OTAPI()->GenerateBasketExchange(
14060 theServerID, theUserID, theBasketAssetTypeID, theBasketAssetAcctID,
14061 nTransferMultiple));
14064 if (
nullptr == pBasket)
return "";
14070 std::string pBuf = strOutput.
Get();
14085 const std::string& SERVER_ID,
const std::string& USER_ID,
14086 const std::string& THE_BASKET,
const std::string& ASSET_TYPE_ID,
14087 const std::string& ASSET_ACCT_ID)
const
14089 if (SERVER_ID.empty()) {
14090 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
14093 if (USER_ID.empty()) {
14094 otErr << __FUNCTION__ <<
": Null: USER_ID passed in!\n";
14097 if (THE_BASKET.empty()) {
14098 otErr << __FUNCTION__ <<
": Null: THE_BASKET passed in!\n";
14101 if (ASSET_TYPE_ID.empty()) {
14102 otErr << __FUNCTION__ <<
": Null: ASSET_TYPE_ID passed in!\n";
14105 if (ASSET_ACCT_ID.empty()) {
14106 otErr << __FUNCTION__ <<
": Null: ASSET_ACCT_ID passed in!\n";
14111 const OTIdentifier theServerID(SERVER_ID), theUserID(USER_ID),
14112 theAssetTypeID(ASSET_TYPE_ID), theAssetAcctID(ASSET_ACCT_ID);
14115 bool bAdded =
false;
14122 theServerID, theUserID, theBasket, theAssetTypeID, theAssetAcctID);
14125 if (!bAdded)
return "";
14129 std::string pBuf = strOutput.
Get();
14163 const std::string& SERVER_ID,
const std::string& USER_ID,
14164 const std::string& BASKET_ASSET_ID,
const std::string& THE_BASKET,
14165 const bool& BOOL_EXCHANGE_IN_OR_OUT)
const
14169 if (SERVER_ID.empty()) {
14170 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
14173 if (USER_ID.empty()) {
14174 otErr << __FUNCTION__ <<
": Null: USER_ID passed in!\n";
14177 if (BASKET_ASSET_ID.empty()) {
14178 otErr << __FUNCTION__ <<
": Null: BASKET_ASSET_ID passed in!\n";
14181 if (THE_BASKET.empty()) {
14182 otErr << __FUNCTION__ <<
": Null: THE_BASKET passed in!\n";
14186 OTIdentifier theServerID(SERVER_ID), theUserID(USER_ID),
14187 theBasketAssetID(BASKET_ASSET_ID);
14189 OTString strBasketInfo(THE_BASKET);
14192 const bool& bExchangeInOrOut =
14193 ((
true == BOOL_EXCHANGE_IN_OR_OUT) ?
true :
false);
14195 return OTAPI()->exchangeBasket(theServerID, theUserID, theBasketAssetID,
14196 strBasketInfo, bExchangeInOrOut);
14210 const std::string& USER_ID)
const
14212 if (SERVER_ID.empty()) {
14213 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
14216 if (USER_ID.empty()) {
14217 otErr << __FUNCTION__ <<
": Null: USER_ID passed in!\n";
14221 OTIdentifier theServerID(SERVER_ID), theUserID(USER_ID);
14237 const std::string& USER_ID,
14238 const std::string& ACCT_ID,
14239 const int64_t& AMOUNT)
const
14241 if (SERVER_ID.empty()) {
14242 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
14245 if (USER_ID.empty()) {
14246 otErr << __FUNCTION__ <<
": Null: USER_ID passed in!\n";
14249 if (ACCT_ID.empty()) {
14250 otErr << __FUNCTION__ <<
": Null: ACCT_ID passed in!\n";
14254 otErr << __FUNCTION__ <<
": Negative: AMOUNT passed in!\n";
14258 OTIdentifier theServerID(SERVER_ID), theUserID(USER_ID), theAcctID(ACCT_ID);
14261 static_cast<int64_t>(AMOUNT));
14275 const std::string& USER_ID,
14276 const std::string& ACCT_ID,
14277 const std::string& THE_PURSE)
const
14279 if (SERVER_ID.empty()) {
14280 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
14283 if (USER_ID.empty()) {
14284 otErr << __FUNCTION__ <<
": Null: USER_ID passed in!\n";
14287 if (ACCT_ID.empty()) {
14288 otErr << __FUNCTION__ <<
": Null: ACCT_ID passed in!\n";
14291 if (THE_PURSE.empty()) {
14292 otErr << __FUNCTION__ <<
": Null: THE_PURSE passed in!\n";
14296 OTIdentifier theServerID(SERVER_ID), theUserID(USER_ID), theAcctID(ACCT_ID);
14314 const std::string& USER_ID,
14315 const std::string& ACCT_FROM,
14316 const std::string& ACCT_TO,
14317 const int64_t& AMOUNT,
14318 const std::string& NOTE)
const
14320 if (SERVER_ID.empty()) {
14321 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
14324 if (USER_ID.empty()) {
14325 otErr << __FUNCTION__ <<
": Null: USER_ID passed in!\n";
14328 if (ACCT_FROM.empty()) {
14329 otErr << __FUNCTION__ <<
": Null: ACCT_FROM passed in!\n";
14332 if (ACCT_TO.empty()) {
14333 otErr << __FUNCTION__ <<
": Null: ACCT_TO passed in!\n";
14337 otErr << __FUNCTION__ <<
": Negative: AMOUNT passed in!\n";
14341 OTIdentifier theServerID(SERVER_ID), theUserID(USER_ID);
14342 OTIdentifier theFromAcct(ACCT_FROM), theToAcct(ACCT_TO);
14344 OTString strNote(NOTE.empty() ?
"" : NOTE);
14346 int64_t lAmount = AMOUNT;
14349 theToAcct, static_cast<int64_t>(lAmount),
14364 const std::string& USER_ID,
14365 const std::string& ACCT_ID)
const
14367 if (SERVER_ID.empty()) {
14368 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
14371 if (USER_ID.empty()) {
14372 otErr << __FUNCTION__ <<
": Null: USER_ID passed in!\n";
14375 if (ACCT_ID.empty()) {
14376 otErr << __FUNCTION__ <<
": Null: ACCT_ID passed in!\n";
14380 OTIdentifier theServerID(SERVER_ID), theUserID(USER_ID), theAcctID(ACCT_ID);
14382 return OTAPI()->
getInbox(theServerID, theUserID, theAcctID);
14396 const std::string& USER_ID)
const
14398 if (SERVER_ID.empty()) {
14399 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
14402 if (USER_ID.empty()) {
14403 otErr << __FUNCTION__ <<
": Null: USER_ID passed in!\n";
14407 OTIdentifier theServerID(SERVER_ID), theUserID(USER_ID);
14423 const std::string& USER_ID,
14424 const std::string& ACCT_ID)
const
14426 if (SERVER_ID.empty()) {
14427 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
14430 if (USER_ID.empty()) {
14431 otErr << __FUNCTION__ <<
": Null: USER_ID passed in!\n";
14434 if (ACCT_ID.empty()) {
14435 otErr << __FUNCTION__ <<
": Null: ACCT_ID passed in!\n";
14439 OTIdentifier theServerID(SERVER_ID), theUserID(USER_ID), theAcctID(ACCT_ID);
14455 const std::string& USER_ID,
14456 const std::string& ACCT_ID,
14457 const std::string& ACCT_LEDGER)
const
14459 if (SERVER_ID.empty()) {
14460 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
14463 if (USER_ID.empty()) {
14464 otErr << __FUNCTION__ <<
": Null: USER_ID passed in!\n";
14467 if (ACCT_ID.empty()) {
14468 otErr << __FUNCTION__ <<
": Null: ACCT_ID passed in!\n";
14471 if (ACCT_LEDGER.empty()) {
14472 otErr << __FUNCTION__ <<
": Null: ACCT_LEDGER passed in!\n";
14482 OTIdentifier theServerID(SERVER_ID), theUserID(USER_ID), theAcctID(ACCT_ID);
14503 const std::string& USER_ID)
const
14505 if (SERVER_ID.empty()) {
14506 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
14509 if (USER_ID.empty()) {
14510 otErr << __FUNCTION__ <<
": Null: USER_ID passed in!\n";
14514 OTIdentifier theServerID(SERVER_ID), theUserID(USER_ID);
14530 const std::string& USER_ID,
14531 const std::string& ACCT_ID,
14532 const std::string& RECIPIENT_USER_ID,
14533 const std::string& CHEQUE_MEMO,
14534 const int64_t& AMOUNT)
const
14536 if (SERVER_ID.empty()) {
14537 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
14540 if (USER_ID.empty()) {
14541 otErr << __FUNCTION__ <<
": Null: USER_ID passed in!\n";
14544 if (ACCT_ID.empty()) {
14545 otErr << __FUNCTION__ <<
": Null: ACCT_ID passed in!\n";
14548 if (RECIPIENT_USER_ID.empty()) {
14549 otErr << __FUNCTION__ <<
": Null: RECIPIENT_USER_ID passed in!\n";
14556 otErr << __FUNCTION__ <<
": Negative: AMOUNT passed in!\n";
14560 OTIdentifier theServerID(SERVER_ID), theUserID(USER_ID), theAcctID(ACCT_ID),
14561 theRecipientUserID(RECIPIENT_USER_ID);
14564 int64_t lAmount = AMOUNT;
14567 theRecipientUserID, strMemo,
14568 static_cast<int64_t>(lAmount));
14574 const std::string& SERVER_ID,
14575 const std::string& ISSUER_USER_ID,
14576 const std::string& DIVIDEND_FROM_ACCT_ID,
14579 const std::string& SHARES_ASSET_TYPE_ID,
14582 const std::string& DIVIDEND_MEMO,
14584 const int64_t& AMOUNT_PER_SHARE)
const
14589 if (SERVER_ID.empty()) {
14590 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
14593 if (ISSUER_USER_ID.empty()) {
14594 otErr << __FUNCTION__ <<
": Null: ISSUER_USER_ID passed in!\n";
14597 if (DIVIDEND_FROM_ACCT_ID.empty()) {
14598 otErr << __FUNCTION__ <<
": Null: DIVIDEND_FROM_ACCT_ID passed in!\n";
14601 if (SHARES_ASSET_TYPE_ID.empty()) {
14602 otErr << __FUNCTION__ <<
": Null: SHARES_ASSET_TYPE_ID passed in!\n";
14608 if (0 > AMOUNT_PER_SHARE) {
14609 otErr << __FUNCTION__ <<
": Negative: AMOUNT_PER_SHARE passed in!\n";
14613 OTIdentifier theServerID(SERVER_ID), theIssuerUserID(ISSUER_USER_ID),
14614 theDividendFromAcctID(DIVIDEND_FROM_ACCT_ID),
14615 theSharesAssetTypeID(SHARES_ASSET_TYPE_ID);
14618 int64_t lAmount = AMOUNT_PER_SHARE;
14620 return OTAPI()->payDividend(theServerID, theIssuerUserID,
14621 theDividendFromAcctID, theSharesAssetTypeID,
14622 strMemo, static_cast<int64_t>(lAmount));
14636 const std::string& USER_ID,
14637 const std::string& ACCT_ID,
14638 const std::string& THE_CHEQUE)
const
14640 if (SERVER_ID.empty()) {
14641 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
14644 if (USER_ID.empty()) {
14645 otErr << __FUNCTION__ <<
": Null: USER_ID passed in!\n";
14648 if (ACCT_ID.empty()) {
14649 otErr << __FUNCTION__ <<
": Null: ACCT_ID passed in!\n";
14652 if (THE_CHEQUE.empty()) {
14653 otErr << __FUNCTION__ <<
": Null: THE_CHEQUE passed in!\n";
14657 OTIdentifier theServerID(SERVER_ID), theUserID(USER_ID), theAcctID(ACCT_ID);
14679 const std::string& SERVER_ID,
const std::string& USER_ID,
14680 const std::string& THE_PAYMENT_PLAN)
const
14682 if (SERVER_ID.empty()) {
14683 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
14686 if (USER_ID.empty()) {
14687 otErr << __FUNCTION__ <<
": Null: USER_ID passed in!\n";
14690 if (THE_PAYMENT_PLAN.empty()) {
14691 otErr << __FUNCTION__ <<
": Null: THE_PAYMENT_PLAN passed in!\n";
14695 const OTIdentifier theServerID(SERVER_ID), theUserID(USER_ID);
14696 const OTString strPlan(THE_PAYMENT_PLAN);
14716 const std::string& USER_ID,
14717 const std::string& ASSET_ACCT_ID,
14718 const int64_t& TRANSACTION_NUMBER)
const
14720 if (SERVER_ID.empty()) {
14721 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
14724 if (USER_ID.empty()) {
14725 otErr << __FUNCTION__ <<
": Null: USER_ID passed in!\n";
14728 if (ASSET_ACCT_ID.empty()) {
14729 otErr << __FUNCTION__ <<
": Null: ASSET_ACCT_ID passed in!\n";
14732 if (0 > TRANSACTION_NUMBER) {
14733 otErr << __FUNCTION__ <<
": Negative: TRANSACTION_NUMBER passed in!\n";
14737 const int64_t lTransactionNumber = TRANSACTION_NUMBER;
14739 const OTIdentifier theServerID(SERVER_ID), theUserID(USER_ID),
14740 theAssetAcctID(ASSET_ACCT_ID);
14743 static_cast<int64_t>(lTransactionNumber));
14760 const std::string& USER_ID,
14761 const std::string& FROM_ACCT_ID,
14762 const int64_t& TRANSACTION_NUMBER)
const
14764 if (SERVER_ID.empty()) {
14765 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
14768 if (USER_ID.empty()) {
14769 otErr << __FUNCTION__ <<
": Null: USER_ID passed in!\n";
14772 if (FROM_ACCT_ID.empty()) {
14773 otErr << __FUNCTION__ <<
": Null: FROM_ACCT_ID passed in!\n";
14776 if (0 > TRANSACTION_NUMBER) {
14777 otErr << __FUNCTION__ <<
": Negative: TRANSACTION_NUMBER passed in!\n";
14781 const int64_t lTransactionNumber = TRANSACTION_NUMBER;
14783 const OTIdentifier theServerID(SERVER_ID), theUserID(USER_ID),
14784 theFromAcctID(FROM_ACCT_ID);
14787 static_cast<int64_t>(lTransactionNumber));
14803 const std::string& ASSET_ACCT_ID,
14804 const std::string& CURRENCY_ACCT_ID,
14806 const int64_t& MARKET_SCALE,
14808 const int64_t& MINIMUM_INCREMENT,
14810 const int64_t& TOTAL_ASSETS_ON_OFFER,
14813 const int64_t& PRICE_LIMIT,
14814 const bool& bBuyingOrSelling,
14815 const time64_t& LIFESPAN_IN_SECONDS,
14817 const std::string& STOP_SIGN,
14819 const int64_t& ACTIVATION_PRICE)
const
14824 if (ASSET_ACCT_ID.empty()) {
14825 otErr << __FUNCTION__ <<
": Null: ASSET_ACCT_ID passed in!\n";
14828 if (CURRENCY_ACCT_ID.empty()) {
14829 otErr << __FUNCTION__ <<
": Null: CURRENCY_ACCT_ID passed in!\n";
14832 if (0 > MARKET_SCALE) {
14833 otErr << __FUNCTION__ <<
": Negative: MARKET_SCALE passed in!\n";
14836 if (0 > MINIMUM_INCREMENT) {
14837 otErr << __FUNCTION__ <<
": Negative: MINIMUM_INCREMENT passed in!\n";
14840 if (0 > TOTAL_ASSETS_ON_OFFER) {
14841 otErr << __FUNCTION__
14842 <<
": Negative: TOTAL_ASSETS_ON_OFFER passed in!\n";
14845 if (0 > PRICE_LIMIT) {
14846 otErr << __FUNCTION__ <<
": Negative: PRICE_LIMIT passed in!\n";
14849 if (0 > ACTIVATION_PRICE) {
14850 otErr << __FUNCTION__ <<
": Negative: ACTIVATION_PRICE passed in!\n";
14853 char cStopSign = 0;
14855 if (0 == STOP_SIGN.compare(
"<"))
14857 else if (0 == STOP_SIGN.compare(
">"))
14859 if (!STOP_SIGN.empty() && ((ACTIVATION_PRICE == 0) ||
14860 ((cStopSign !=
'<') && (cStopSign !=
'>')))) {
14861 otErr << __FUNCTION__ <<
": If STOP_SIGN is provided, it must be \"<\" "
14862 "or \">\", and in that case ACTIVATION_PRICE "
14863 "must be non-zero.\n";
14867 theCurrencyAcctID(CURRENCY_ACCT_ID);
14868 const std::string str_asset_server_id =
14870 const std::string str_currency_server_id =
14872 const std::string str_asset_nym_id =
14874 const std::string str_currency_nym_id =
14876 if (str_asset_server_id.empty() || str_currency_server_id.empty() ||
14877 str_asset_nym_id.empty() || str_currency_nym_id.empty()) {
14878 otErr << __FUNCTION__ <<
": Failed determining server or nym ID for "
14879 "either asset or currency account.\n";
14882 const OTIdentifier theAssetServerID(str_asset_server_id),
14883 theAssetUserID(str_asset_nym_id),
14884 theCurrencyServerID(str_currency_server_id),
14885 theCurrencyUserID(str_currency_nym_id);
14886 if (theAssetServerID != theCurrencyServerID) {
14887 otErr << __FUNCTION__
14888 <<
": The accounts provided are on two different servers.\n";
14891 if (theAssetUserID != theCurrencyUserID) {
14892 otErr << __FUNCTION__
14893 <<
": The accounts provided are owned by two different nyms.\n";
14898 int64_t lMarketScale = (0 == MARKET_SCALE) ? 1 : MARKET_SCALE;
14899 int64_t lMinIncrement = (0 == MINIMUM_INCREMENT) ? 1 : MINIMUM_INCREMENT;
14900 int64_t lTotalAssetsOnOffer =
14901 (0 == TOTAL_ASSETS_ON_OFFER) ? 1 : TOTAL_ASSETS_ON_OFFER;
14902 int64_t lPriceLimit = PRICE_LIMIT;
14903 return OTAPI()->issueMarketOffer(
14904 theAssetServerID, theAssetUserID, theAssetAcctID, theCurrencyAcctID,
14905 static_cast<int64_t>(lMarketScale), static_cast<int64_t>(lMinIncrement),
14906 static_cast<int64_t>(lTotalAssetsOnOffer),
14907 static_cast<int64_t>(lPriceLimit), bBuyingOrSelling,
14908 LIFESPAN_IN_SECONDS, cStopSign, static_cast<int64_t>(ACTIVATION_PRICE));
14922 const std::string& USER_ID)
const
14924 if (SERVER_ID.empty()) {
14925 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
14928 if (USER_ID.empty()) {
14929 otErr << __FUNCTION__ <<
": Null: USER_ID passed in!\n";
14933 const OTIdentifier theServerID(SERVER_ID), theUserID(USER_ID);
14949 const std::string& USER_ID,
14950 const std::string& MARKET_ID,
14951 const int64_t& MAX_DEPTH)
const
14953 if (SERVER_ID.empty()) {
14954 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
14957 if (USER_ID.empty()) {
14958 otErr << __FUNCTION__ <<
": Null: USER_ID passed in!\n";
14961 if (0 > MAX_DEPTH) {
14962 otErr << __FUNCTION__ <<
": Negative: MAX_DEPTH passed in!\n";
14966 const OTIdentifier theServerID(SERVER_ID), theUserID(USER_ID),
14967 theMarketID(MARKET_ID);
14969 const int64_t lDepth = MAX_DEPTH;
14971 otErr << __FUNCTION__
14972 <<
": lDepth is out of bounds (it's in the negative!)\n";
14977 static_cast<int64_t>(lDepth));
14991 const std::string& USER_ID,
14992 const std::string& MARKET_ID)
const
14994 if (SERVER_ID.empty()) {
14995 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
14998 if (USER_ID.empty()) {
14999 otErr << __FUNCTION__ <<
": Null: USER_ID passed in!\n";
15002 if (MARKET_ID.empty()) {
15003 otErr << __FUNCTION__ <<
": Null: MARKET_ID passed in!\n";
15007 const OTIdentifier theServerID(SERVER_ID), theUserID(USER_ID),
15008 theMarketID(MARKET_ID);
15024 const std::string& USER_ID)
const
15026 if (SERVER_ID.empty()) {
15027 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
15030 if (USER_ID.empty()) {
15031 otErr << __FUNCTION__ <<
": Null: USER_ID passed in!\n";
15035 const OTIdentifier theServerID(SERVER_ID), theUserID(USER_ID);
15066 const std::string& SERVER_ID,
15067 const std::string& USER_ID)
const
15069 if (0 > REQUEST_NUMBER) {
15070 otErr << __FUNCTION__ <<
": Negative: REQUEST_NUMBER passed in!\n";
15073 if (SERVER_ID.empty()) {
15074 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
15077 if (USER_ID.empty()) {
15078 otErr << __FUNCTION__ <<
": Null: USER_ID passed in!\n";
15082 const int64_t lRequestNum = REQUEST_NUMBER;
15083 const OTIdentifier theServerID(SERVER_ID), theUserID(USER_ID);
15085 static_cast<int64_t>(lRequestNum), theServerID,
15088 if (
nullptr == pMsg)
15090 otErr << __FUNCTION__ <<
": Reply not found, sorry.\n";
15096 std::string pBuf = strOutput.
Get();
15130 const std::string& SERVER_ID,
15131 const std::string& USER_ID)
const
15133 if (0 > REQUEST_NUMBER) {
15134 otErr << __FUNCTION__ <<
": Negative: REQUEST_NUMBER passed in!\n";
15137 if (SERVER_ID.empty()) {
15138 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
15141 if (USER_ID.empty()) {
15142 otErr << __FUNCTION__ <<
": Null: USER_ID passed in!\n";
15145 const int64_t lRequestNum = REQUEST_NUMBER;
15146 const OTIdentifier theServerID(SERVER_ID), theUserID(USER_ID);
15148 theServerID, theUserID);
15150 if (
nullptr == pMsg)
15152 otWarn << __FUNCTION__ <<
": Message not found with request number "
15153 << lRequestNum <<
", sorry.\n";
15160 std::string pBuf = strOutput.
Get();
15173 const std::string& SERVER_ID,
15174 const std::string& USER_ID)
const
15176 if (0 > REQUEST_NUMBER) {
15177 otErr << __FUNCTION__ <<
": Negative: REQUEST_NUMBER passed in!\n";
15180 if (SERVER_ID.empty()) {
15181 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
15184 if (USER_ID.empty()) {
15185 otErr << __FUNCTION__ <<
": Null: USER_ID passed in!\n";
15188 const int64_t lRequestNum = REQUEST_NUMBER;
15189 const OTIdentifier theServerID(SERVER_ID), theUserID(USER_ID);
15191 static_cast<int64_t>(lRequestNum), theServerID, theUserID);
15225 const std::string& SERVER_ID,
15226 const std::string& USER_ID,
15227 const std::string& THE_NYMBOX)
const
15229 if (SERVER_ID.empty()) {
15230 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
15234 if (USER_ID.empty()) {
15235 otErr << __FUNCTION__ <<
": Null: USER_ID passed in!\n";
15239 if (THE_NYMBOX.empty()) {
15240 otErr << __FUNCTION__ <<
": Null: THE_NYMBOX passed in!\n";
15245 const OTIdentifier theServerID(SERVER_ID), theUserID(USER_ID);
15246 const OTString strLedger(THE_NYMBOX);
15247 OTLedger theLedger(theUserID, theUserID, theServerID);
15252 otErr << __FUNCTION__
15253 <<
": Failure: Unable to load Nymbox from string:\n\n"
15254 << strLedger <<
"\n\n";
15262 if (!bIsInitialized) {
15263 otErr << __FUNCTION__
15264 <<
": Not initialized; call OT_API::Init first.\n";
15269 if (0 > MILLISECONDS) {
15270 otErr << __FUNCTION__ <<
": Negative: MILLISECONDS passed in!\n";
15275 const int64_t lMilliseconds = MILLISECONDS;
15288 const std::string& USER_ID,
15289 const std::string& THE_MESSAGE)
const
15292 if (!bIsInitialized) {
15293 otErr << __FUNCTION__
15294 <<
": Not initialized; call OT_API::Init first.\n";
15298 if (SERVER_ID.empty()) {
15299 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
15302 if (USER_ID.empty()) {
15303 otErr << __FUNCTION__ <<
": Null: USER_ID passed in!\n";
15306 if (THE_MESSAGE.empty()) {
15307 otErr << __FUNCTION__ <<
": Null: THE_MESSAGE passed in!\n";
15311 OTIdentifier theServerID(SERVER_ID), theNymID(USER_ID);
15312 const OTString strMessage(THE_MESSAGE), strNymID(theNymID);
15315 if (
nullptr == pNym)
return false;
15319 otErr << __FUNCTION__ <<
": Failed trying to load @createUserAccount() "
15320 "message from string (it's a server reply.) "
15321 "Contents:\n\n" << strMessage <<
"\n\n";
15325 otErr << __FUNCTION__
15326 <<
": Failed. Though success loading message from string, it had "
15327 "the wrong NymID. (Expected " << strNymID <<
", but found "
15328 << theMessage.
m_strNymID <<
".) Message contents:\n\n"
15329 << strMessage <<
"\n\n";
15333 otErr << __FUNCTION__ <<
": Failed. Though success loading message "
15334 "from string, it had the wrong command type. "
15335 "(Expected @createUserAccount, but found "
15336 << theMessage.
m_strCommand <<
".) Message contents:\n\n"
15337 << strMessage <<
"\n\n";
15341 otErr << __FUNCTION__
15342 <<
": Failed. Though success loading @createUserAccount() "
15343 "message, the payload was empty. (Expected theMessageNym to "
15344 "be there, so I could re-sync client side to server.) Message "
15345 "contents:\n\n" << strMessage <<
"\n\n";
15351 otErr << __FUNCTION__ <<
": Failed decoding message payload in server "
15352 "reply: @createUserAccount(). (Expected "
15353 "theMessageNym to be there, so I could "
15354 "re-sync client side to server.) Message "
15355 "contents:\n\n" << strMessage <<
"\n\n";
15361 otErr << __FUNCTION__ <<
": Failed loading theMessageNym from a "
15362 "string. String contents:\n\n" << strMessageNym
15368 OTLedger theNymbox(theNymID, theNymID, theServerID);
15370 bool bSynced =
false;
15371 bool bLoadedNymbox =
15377 otErr << __FUNCTION__
15378 <<
": Failed while loading or verifying Nymbox for User "
15379 << strNymID <<
", on Server " << SERVER_ID <<
" \n";
15402 const std::string& USER_ID,
15403 const std::string& ENCODED_MAP)
const
15405 if (SERVER_ID.empty()) {
15406 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
15409 if (USER_ID.empty()) {
15410 otErr << __FUNCTION__ <<
": Null: USER_ID passed in!\n";
15413 if (ENCODED_MAP.empty()) {
15414 otErr << __FUNCTION__ <<
": Null: ENCODED_MAP passed in!\n";
15418 OTIdentifier theServerID(SERVER_ID), theUserID(USER_ID);
15433 if (THE_MESSAGE.empty()) {
15434 otErr << __FUNCTION__ <<
": Null: THE_MESSAGE passed in!\n";
15458 if (THE_MESSAGE.empty()) {
15459 otErr << __FUNCTION__ <<
": Null: THE_MESSAGE passed in!\n";
15472 std::string pBuf = strOutput.
Get();
15486 if (THE_MESSAGE.empty()) {
15487 otErr << __FUNCTION__ <<
": Null: THE_MESSAGE passed in!\n";
15495 if (!strMessage.
Exists() ||
15497 otOut << __FUNCTION__ <<
": Unable to load message.\n";
15507 otOut << __FUNCTION__
15508 <<
": Wrong message type: " << theMessage.
m_strCommand <<
"\n";
15515 if (!strOutput.
Exists()) {
15516 otOut << __FUNCTION__ <<
": No ledger found on message.\n";
15520 std::string pBuf = strOutput.
Get();
15532 const std::string& THE_MESSAGE)
const
15534 if (THE_MESSAGE.empty()) {
15535 otErr << __FUNCTION__ <<
": Null: THE_MESSAGE passed in!\n";
15543 if (!strMessage.
Exists() ||
15545 otOut << __FUNCTION__ <<
": Unable to load message.\n";
15555 otOut << __FUNCTION__
15556 <<
": Wrong message type: " << theMessage.
m_strCommand <<
"\n";
15562 if (!strOutput.
Exists()) {
15563 otOut << __FUNCTION__ <<
": No new asset type ID found on message.\n";
15567 std::string pBuf = strOutput.
Get();
15579 const std::string& THE_MESSAGE)
const
15581 if (THE_MESSAGE.empty()) {
15582 otErr << __FUNCTION__ <<
": Null: THE_MESSAGE passed in!\n";
15590 if (!strMessage.
Exists() ||
15592 otOut << __FUNCTION__ <<
": Unable to load message.\n";
15602 otOut << __FUNCTION__
15603 <<
": Wrong message type: " << theMessage.
m_strCommand <<
"\n";
15609 if (!strOutput.
Exists()) {
15610 otOut << __FUNCTION__ <<
": No issuer account ID found on message.\n";
15614 std::string pBuf = strOutput.
Get();
15628 const std::string& THE_MESSAGE)
const
15630 if (THE_MESSAGE.empty()) {
15631 otErr << __FUNCTION__ <<
": Null: THE_MESSAGE passed in!\n";
15639 if (!strMessage.
Exists() ||
15641 otOut << __FUNCTION__ <<
": Unable to load message.\n";
15650 otOut << __FUNCTION__
15651 <<
": Wrong message type: " << theMessage.
m_strCommand <<
"\n";
15657 if (!strOutput.
Exists()) {
15658 otOut << __FUNCTION__ <<
": No asset account ID found on message.\n";
15662 std::string pBuf = strOutput.
Get();
15675 const std::string& THE_MESSAGE)
const
15677 if (THE_MESSAGE.empty()) {
15678 otErr << __FUNCTION__ <<
": Null: THE_MESSAGE passed in!\n";
15686 if (!strMessage.
Exists() ||
15688 otOut << __FUNCTION__ <<
": Unable to load message.\n";
15701 otOut << __FUNCTION__
15702 <<
": Wrong message type : " << theMessage.
m_strCommand
15709 otOut << __FUNCTION__
15710 <<
": No NymboxHash found on message: " << strMessage <<
"\n";
15715 std::string pBuf = strOutput.
Get();
15728 if (THE_MESSAGE.empty()) {
15729 otErr << __FUNCTION__ <<
": Null: THE_MESSAGE passed in!\n";
15736 if (!strMessage.
Exists()) {
15737 otErr << __FUNCTION__ <<
": Error: THE_MESSAGE doesn't exist.\n";
15742 otErr << __FUNCTION__
15743 <<
": Error: Failed loading message from string:\n\n"
15744 << THE_MESSAGE <<
"\n\n";
15748 otInfo << __FUNCTION__ <<
": Server reply for RequestNum "
15750 <<
"(Message_GetSuccess was successful, but any transaction "
15751 "inside could have failed OR succeeded. Use "
15752 "Message_GetTransactionSuccess for that.)\n";
15759 otWarn << __FUNCTION__ <<
": ** FYI, server reply was received, and it "
15760 "said 'No.' (Status = failed). RequestNum: "
15795 if (THE_MESSAGE.empty()) {
15796 otErr << __FUNCTION__ <<
": Null: THE_MESSAGE passed in!\n";
15807 return static_cast<int32_t
>(theMessage.
m_lDepth);
15816 const std::string& SERVER_ID,
const std::string& USER_ID,
15817 const std::string& ACCOUNT_ID,
const std::string& THE_MESSAGE)
const
15819 if (SERVER_ID.empty()) {
15820 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
15823 if (USER_ID.empty()) {
15824 otErr << __FUNCTION__ <<
": Null: USER_ID passed in!\n";
15827 if (ACCOUNT_ID.empty()) {
15828 otErr << __FUNCTION__ <<
": Null: ACCOUNT_ID passed in!\n";
15831 if (THE_MESSAGE.empty()) {
15832 otErr << __FUNCTION__ <<
": Null: THE_MESSAGE passed in!\n";
15836 const OTIdentifier theServerID(SERVER_ID), theUserID(USER_ID),
15837 theAccountID(ACCOUNT_ID);
15843 if (!strMessage.
Exists() ||
15845 otOut << __FUNCTION__ <<
": Unable to load message.\n";
15856 otOut << __FUNCTION__
15857 <<
": Wrong message type: " << theMessage.
m_strCommand <<
"\n";
15864 if (!strLedger.
Exists()) {
15865 otOut << __FUNCTION__ <<
": No ledger found on message.\n";
15869 OTLedger theLedger(theUserID, theAccountID, theServerID);
15873 otErr << __FUNCTION__
15874 <<
": Error loading ledger from string. Acct ID: " << strAcctID
15882 otErr << __FUNCTION__ <<
": bad count in message ledger: "
15892 if (
nullptr == pTransaction) {
15893 otErr << __FUNCTION__
15894 <<
": good index but uncovered \"\" pointer: " << 0 <<
"\n";
15912 const std::string& SERVER_ID,
const std::string& USER_ID,
15913 const std::string& ACCOUNT_ID,
const std::string& THE_MESSAGE)
const
15915 if (SERVER_ID.empty()) {
15916 otErr << __FUNCTION__ <<
": Null: SERVER_ID passed in!\n";
15919 if (USER_ID.empty()) {
15920 otErr << __FUNCTION__ <<
": Null: USER_ID passed in!\n";
15923 if (ACCOUNT_ID.empty()) {
15924 otErr << __FUNCTION__ <<
": Null: ACCOUNT_ID passed in!\n";
15927 if (THE_MESSAGE.empty()) {
15928 otErr << __FUNCTION__ <<
": Null: THE_MESSAGE passed in!\n";
15932 const OTIdentifier theServerID(SERVER_ID), theUserID(USER_ID),
15933 theAccountID(ACCOUNT_ID);
15939 if (!strMessage.
Exists() ||
15941 otOut << __FUNCTION__ <<
": Unable to load message.\n";
15952 otOut << __FUNCTION__
15953 <<
": Wrong message type: " << theMessage.
m_strCommand <<
"\n";
15960 if (!strLedger.
Exists()) {
15961 otOut << __FUNCTION__ <<
": No ledger found on message.\n";
15965 OTLedger theLedger(theUserID, theAccountID, theServerID);
15969 otErr << __FUNCTION__
15970 <<
": Error loading ledger from string. Acct ID: " << strAcctID
15978 otErr << __FUNCTION__ <<
": bad count in message ledger: "
15988 if (
nullptr == pTransaction) {
15989 otErr << __FUNCTION__
15990 <<
": good index but uncovered \"\" pointer: " << 0 <<
"\n";
16000 const int64_t lRequestNum =
16005 <<
": ** FYI, server reply was received, and it said 'No.' "
16006 "(Status = failed). RequestNum: " << lRequestNum
16007 <<
", TransNum: " << lTransactionNum
EXPORT bool ResyncNymWithServer(OTPseudonym &theNym, const OTLedger &theNymbox, const OTPseudonym &theMessageNym) const
EXPORT bool GetAmount(int64_t &lOutput) const
EXPORT int32_t NumList_Count(const OTNumList &theList) const
EXPORT bool Nym_RemoveMailByIndex(const std::string &NYM_ID, const int32_t &nIndex) const
EXPORT int32_t GetIssuedNumCount(const OTIdentifier &theServerID) const
EXPORT std::string Message_GetNewAcctID(const std::string &THE_MESSAGE) const
EXPORT int32_t deleteUserAccount(const OTIdentifier &SERVER_ID, const OTIdentifier &USER_ID) const
EXPORT void GetReferenceString(OTString &theStr) const
EXPORT int32_t GetServerCount() const
EXPORT bool ResyncNymWithServer(const std::string &SERVER_ID, const std::string &USER_ID, const std::string &THE_MESSAGE) const
EXPORT std::string AddSignature(const std::string &SIGNER_NYM_ID, const std::string &THE_CONTRACT) const
EXPORT bool VerifyAccountReceipt(const OTIdentifier &SERVER_ID, const OTIdentifier &USER_ID, const OTIdentifier &ACCOUNT_ID) const
EXPORT bool AddSignature(const OTIdentifier &theSignerNymID, const OTString &strContract, OTString &strOutput) const
EXPORT bool RemoveTransaction(int64_t lTransactionNum, bool bDeleteIt=true)
OTLOG_IMPORT OTLogStream otLog4
EXPORT std::string SymmetricEncrypt(const std::string &SYMMETRIC_KEY, const std::string &PLAINTEXT) const
EXPORT std::string NumList_Add(const std::string &strNumList, const std::string &strNumbers) const
EXPORT std::string Transaction_GetSenderUserID(const std::string &SERVER_ID, const std::string &USER_ID, const std::string &ACCOUNT_ID, const std::string &THE_TRANSACTION) const
void SetAmount(int64_t lAmount)
EXPORT int32_t AddAssetContract(const std::string &strContract) const
EXPORT OTItem * GenerateBalanceStatement(int64_t lAdjustment, const OTTransaction &theOwner, OTPseudonym &theNym, const OTAccount &theAccount, OTLedger &theOutbox)
EXPORT bool GetServerID(OTIdentifier &theOutput) const
EXPORT bool SetAccount_Name(const OTIdentifier &ACCT_ID, const OTIdentifier &SIGNER_NYM_ID, const OTString &ACCT_NEW_NAME) const
EXPORT bool Encrypt(const OTIdentifier &theRecipientNymID, const OTString &strPlaintext, OTString &strOutput) const
EXPORT std::string Party_GetAcctNameByIndex(const std::string &THE_CONTRACT, const std::string &PARTY_NAME, const int32_t &nIndex) const
EXPORT int32_t notarizeDeposit(const std::string &SERVER_ID, const std::string &USER_ID, const std::string &ACCT_ID, const std::string &THE_PURSE) const
EXPORT int32_t issueAssetType(const std::string &SERVER_ID, const std::string &USER_ID, const std::string &THE_CONTRACT) const
EXPORT int32_t triggerClause(const std::string &SERVER_ID, const std::string &USER_ID, const int64_t &TRANSACTION_NUMBER, const std::string &CLAUSE_NAME, const std::string &STR_PARAM) const
static EXPORT int64_t StringToLong(const std::string &number)
int32_t GetTransactionCount() const
EXPORT int32_t issueBasket(const OTIdentifier &SERVER_ID, const OTIdentifier &USER_ID, const OTString &BASKET_INFO) const
EXPORT std::string SmartContract_ConfirmAccount(const std::string &THE_CONTRACT, const std::string &SIGNER_NYM_ID, const std::string &PARTY_NAME, const std::string &ACCT_NAME, const std::string &AGENT_NAME, const std::string &ACCT_ID) const
EXPORT int32_t getBoxReceipt(const std::string &SERVER_ID, const std::string &USER_ID, const std::string &ACCOUNT_ID, const int32_t &nBoxType, const int64_t &TRANSACTION_NUMBER) const
EXPORT int32_t GetHookCount() const
EXPORT OTAgent * GetAgentByIndex(int32_t nIndex) const
EXPORT std::string Bylaw_GetLanguage(const std::string &THE_CONTRACT, const std::string &BYLAW_NAME) const
EXPORT time64_t Instrmnt_GetValidFrom(const std::string &THE_INSTRUMENT) const
EXPORT int32_t GetNymCount() const
EXPORT bool GetSenderAcctIDForDisplay(OTIdentifier &theReturnID)
EXPORT std::string Pending_GetNote(const std::string &SERVER_ID, const std::string &USER_ID, const std::string &ACCOUNT_ID, const std::string &THE_TRANSACTION) const
static EXPORT bool InitOTApp()
EXPORT bool GetRemitterAcctID(OTIdentifier &theOutput) const
static EXPORT OTTransaction * GenerateTransaction(const OTIdentifier &theUserID, const OTIdentifier &theAccountID, const OTIdentifier &theServerID, transactionType theType, int64_t lTransactionNum=0)
EXPORT bool AddBasketExchangeItem(const OTIdentifier &SERVER_ID, const OTIdentifier &USER_ID, Basket &theBasket, const OTIdentifier &ASSET_TYPE_ID, const OTIdentifier &ASSET_ACCT_ID) const
EXPORT int32_t Transaction_IsCanceled(const std::string &SERVER_ID, const std::string &USER_ID, const std::string &ACCOUNT_ID, const std::string &THE_TRANSACTION) const
EXPORT std::string Create_SmartContract(const std::string &SIGNER_NYM_ID, const time64_t &VALID_FROM, const time64_t &VALID_TO) const
const OTIdentifier & GetRequestAccountID()
static EXPORT OTItem * CreateItemFromString(const OTString &strItem, const OTIdentifier &theServerID, int64_t lTransactionNumber)
EXPORT int32_t Party_GetAgentCount(const std::string &THE_CONTRACT, const std::string &PARTY_NAME) const
static EXPORT void Output(int32_t nVerbosity, const char *szOutput)
EXPORT std::string LoadRecordBox(const std::string &SERVER_ID, const std::string &USER_ID, const std::string &ACCOUNT_ID) const
NOTE: Sometimes the user ID is also passed in the "account ID" field,.
EXPORT void SetNumberOfOrigin(int64_t lTransactionNum)
EXPORT const OTSubcredential * GetSubcredential(const OTString &strSubID, const OTString::List *plistRevokedIDs=nullptr) const
static EXPORT bool CleanupOTApp()
EXPORT int32_t getMarketOffers(const OTIdentifier &SERVER_ID, const OTIdentifier &USER_ID, const OTIdentifier &MARKET_ID, const int64_t &lDepth) const
EXPORT std::string SmartContract_AddBylaw(const std::string &THE_CONTRACT, const std::string &SIGNER_NYM_ID, const std::string &BYLAW_NAME) const
EXPORT bool LoadBoxReceipt(const int64_t &lTransactionNum)
EXPORT std::string GetAccountWallet_OutboxHash(const std::string &ACCOUNT_ID) const
OTVariable_Type GetType() const
EXPORT std::string SmartContract_AddParty(const std::string &THE_CONTRACT, const std::string &SIGNER_NYM_ID, const std::string &PARTY_NAME, const std::string &AGENT_NAME) const
EXPORT int32_t cancelCronItem(const OTIdentifier &SERVER_ID, const OTIdentifier &USER_ID, const OTIdentifier &ASSET_ACCT_ID, const int64_t &lTransactionNum) const
EXPORT std::string GetPartyName(bool *pBoolSuccess=nullptr) const
EXPORT int32_t createAssetAccount(const OTIdentifier &SERVER_ID, const OTIdentifier &USER_ID, const OTIdentifier &ASSET_ID) const
EXPORT bool GetValidFrom(time64_t &tOutput) const
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) const
EXPORT int32_t Count() const
EXPORT int32_t GetNym_SubcredentialCount(const std::string &NYM_ID, const std::string &MASTER_CRED_ID) const
EXPORT OTPseudonym * GetOrLoadNym(const OTIdentifier &NYM_ID, bool bChecking=false, const char *szFuncName=nullptr, const OTPasswordData *pPWData=nullptr) const
EXPORT std::string GetActiveCronItem(const std::string &SERVER_ID, int64_t lTransNum) const
EXPORT OTClause * GetClauseByIndex(int32_t nIndex)
EXPORT std::string CreateAssetContract(const std::string &NYM_ID, const std::string &strXMLcontents) const
EXPORT bool DiscardCheque(const std::string &SERVER_ID, const std::string &USER_ID, const std::string &ACCT_ID, const std::string &THE_CHEQUE) const
EXPORT std::string CalculateServerContractID(const std::string &str_Contract) const
EXPORT std::string GetAssetType_Name(const std::string &ASSET_TYPE_ID) const
EXPORT bool Smart_AreAllPartiesConfirmed(const std::string &THE_CONTRACT) const
static EXPORT uint64_t StringToUlong(const std::string &number)
EXPORT std::string CreateServerContract(const std::string &NYM_ID, const std::string &strXMLcontents) const
EXPORT bool SetServer_Name(const std::string &SERVER_ID, const std::string &STR_NEW_NAME) const
EXPORT bool LoadFromString(const OTString &strNym, OTString::Map *pMapCredentials=nullptr, OTString *pstrReason=nullptr, const OTPassword *pImportPassword=nullptr)
EXPORT int32_t killMarketOffer(const std::string &SERVER_ID, const std::string &USER_ID, const std::string &ASSET_ACCT_ID, const int64_t &TRANSACTION_NUMBER) const
virtual EXPORT bool VerifySignature(const OTPseudonym &theNym, const OTPasswordData *pPWData=nullptr) const
EXPORT void GetIdentifier(OTIdentifier &theIdentifier) const
EXPORT int32_t sendUserMessage(const std::string &SERVER_ID, const std::string &USER_ID, const std::string &USER_ID_RECIPIENT, const std::string &RECIPIENT_PUBKEY, const std::string &THE_MESSAGE) const
EXPORT std::string CreateSymmetricKey() const
EXPORT bool IsPasswordProtected() const
EXPORT bool VerifyThisAgainstAllPartiesSignedCopies()
EXPORT void SetHomeFolder(const std::string &strFolder) const
EXPORT void GetAttachment(OTString &theStr) const
EXPORT bool RecordPayment(const std::string &SERVER_ID, const std::string &USER_ID, const bool &bIsInbox, const int32_t &nIndex, const bool &bSaveCopy) const
EXPORT std::string PeekMemlogFront() const
EXPORT int32_t Transaction_GetBalanceAgreementSuccess(const std::string &SERVER_ID, const std::string &USER_ID, const std::string &ACCOUNT_ID, const std::string &THE_TRANSACTION) const
EXPORT bool ClearExpired(const std::string &SERVER_ID, const std::string &USER_ID, const int32_t &nIndex, const bool &bClearAll) const
EXPORT OTAgent * GetAgent(const std::string &str_agent_name) const
EXPORT int64_t GetBasketMinimumTransferAmount(const OTIdentifier &BASKET_ASSET_TYPE_ID) const
EXPORT std::string Party_GetAgentID(const std::string &THE_CONTRACT, const std::string &PARTY_NAME, const std::string &AGENT_NAME) const
EXPORT std::string Instrmnt_GetAssetID(const std::string &THE_INSTRUMENT) const
EXPORT std::string GetMemlogAtIndex(const int32_t &nIndex) const
EXPORT std::string GetServer_ID(const int32_t &nIndex) const
EXPORT std::string GetNym_MailContentsByIndex(const std::string &NYM_ID, const int32_t &nIndex) const
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) const
EXPORT int32_t issueBasket(const std::string &SERVER_ID, const std::string &USER_ID, const std::string &THE_BASKET) const
EXPORT int32_t queryAssetTypes(const OTIdentifier &SERVER_ID, const OTIdentifier &USER_ID, const OTASCIIArmor &ENCODED_MAP) const
virtual EXPORT bool VerifyAccount(const OTPseudonym &theNym)
EXPORT bool Decode(const OTString &strEncoded, OTString &strOutput, bool bLineBreaks=true) const
EXPORT OT_API * OTAPI() const
EXPORT int32_t issueMarketOffer(const std::string &ASSET_ACCT_ID, const std::string &CURRENCY_ACCT_ID, const int64_t &MARKET_SCALE, const int64_t &MINIMUM_INCREMENT, const int64_t &TOTAL_ASSETS_ON_OFFER, const int64_t &PRICE_LIMIT, const bool &bBuyingOrSelling, const time64_t &LIFESPAN_IN_SECONDS, const std::string &STOP_SIGN, const int64_t &ACTIVATION_PRICE) const
EXPORT const OTIdentifier & GetAssetTypeID() const
EXPORT int32_t checkServerID(const OTIdentifier &SERVER_ID, const OTIdentifier &USER_ID) const
int64_t GetTransactionNum() const
EXPORT std::string GetNym_OutmailContentsByIndex(const std::string &NYM_ID, const int32_t &nIndex) const
EXPORT std::string LoadPubkey_Encryption(const std::string &USER_ID) const
EXPORT std::string Transaction_GetType(const std::string &SERVER_ID, const std::string &USER_ID, const std::string &ACCOUNT_ID, const std::string &THE_TRANSACTION) const
Get Transaction Type (internally uses GetTransactionTypeString().)
EXPORT int32_t AddServerContract(const std::string &strContract) const
EXPORT int32_t GetServerCount() const
EXPORT time64_t GetTime() const
EXPORT char const * GetTypeString() const
EXPORT bool GetNymID(OTIdentifier &theOutput) const
static EXPORT bool PopMemlogBack()
EXPORT std::string Ledger_FinalizeResponse(const std::string &SERVER_ID, const std::string &USER_ID, const std::string &ACCOUNT_ID, const std::string &THE_LEDGER) const
EXPORT int64_t GetBalance() const
EXPORT OTCredential * GetMasterCredential(const OTString &strID)
EXPORT int32_t GetNym_RevokedCredCount(const std::string &NYM_ID) const
EXPORT std::string GetAssetType_TLA(const std::string &THE_ID) const
EXPORT bool SetNym_Name(const OTIdentifier &NYM_ID, const OTIdentifier &SIGNER_NYM_ID, const OTString &NYM_NEW_NAME) const
EXPORT bool ClearRecord(const std::string &SERVER_ID, const std::string &USER_ID, const std::string &ACCOUNT_ID, const int32_t &nIndex, const bool &bClearAll) const
EXPORT std::string Wallet_GetServerIDFromPartial(const std::string &PARTIAL_ID) const
EXPORT std::string Transaction_CreateResponse(const std::string &SERVER_ID, const std::string &USER_ID, const std::string &ACCOUNT_ID, const std::string &RESPONSE_LEDGER, const std::string &ORIGINAL_TRANSACTION, const bool &BOOL_DO_I_ACCEPT) const
EXPORT std::string GetServer_Contract(const std::string &SERVER_ID) const
EXPORT int64_t GetBasketMemberMinimumTransferAmount(const OTIdentifier &BASKET_ASSET_TYPE_ID, int32_t nIndex) const
EXPORT std::string Party_GetAcctAssetID(const std::string &THE_CONTRACT, const std::string &PARTY_NAME, const std::string &ACCT_NAME) const
EXPORT int32_t notarizeTransfer(const OTIdentifier &SERVER_ID, const OTIdentifier &USER_ID, const OTIdentifier &ACCT_FROM, const OTIdentifier &ACCT_TO, const int64_t &AMOUNT, const OTString &NOTE) const
EXPORT bool SaveContract()
static EXPORT OTScriptable * InstantiateScriptable(const OTString &strInput)
EXPORT time64_t Token_GetValidTo(const std::string &SERVER_ID, const std::string &ASSET_TYPE_ID, const std::string &THE_TOKEN) const
EXPORT bool VerifyIssuedNum(const OTString &strServerID, const int64_t &lTransNum) const
EXPORT int32_t getNym_MarketOffers(const std::string &SERVER_ID, const std::string &USER_ID) const
This "Market Offer" data is a lot more detailed than the.
EXPORT std::string Variable_GetNameByIndex(const std::string &THE_CONTRACT, const std::string &BYLAW_NAME, const int32_t &nIndex) const
EXPORT bool GetRecipientAcctIDForDisplay(OTIdentifier &theReturnID)
EXPORT int32_t getAccountFiles(const std::string &SERVER_ID, const std::string &USER_ID, const std::string &ACCT_ID) const
EXPORT int64_t Basket_GetMinimumTransferAmount(const std::string &BASKET_ASSET_TYPE_ID) const
EXPORT std::string GetAccountWallet_InboxHash(const std::string &ACCOUNT_ID) const
EXPORT int32_t getMarketRecentTrades(const OTIdentifier &SERVER_ID, const OTIdentifier &USER_ID, const OTIdentifier &MARKET_ID) const
EXPORT void FlushMessageBuffer() const
EXPORT bool AllPartiesHaveSupposedlyConfirmed()
EXPORT const OTString & GetName() const
EXPORT OTBylaw * GetBylaw(std::string str_bylaw_name) const
virtual bool VerifyAccount(const OTPseudonym &theNym)
EXPORT std::string GetNym_RevokedCredID(const std::string &NYM_ID, const int32_t &nIndex) const
EXPORT bool GetNextTransactionNum(OTPseudonym &SIGNER_NYM, const OTString &strServerID, int64_t &lTransNum, bool bSave=true)
EXPORT std::string Clause_GetNameByIndex(const std::string &THE_CONTRACT, const std::string &BYLAW_NAME, const int32_t &nIndex) const
EXPORT int32_t getMint(const OTIdentifier &SERVER_ID, const OTIdentifier &USER_ID, const OTIdentifier &ASSET_ID) const
EXPORT std::string Hook_GetClauseAtIndex(const std::string &THE_CONTRACT, const std::string &BYLAW_NAME, const std::string &HOOK_NAME, const int32_t &nIndex) const
EXPORT int32_t Message_GetDepth(const std::string &THE_MESSAGE) const
EXPORT std::string VerifyAndRetrieveXMLContents(const std::string &THE_CONTRACT, const std::string &SIGNER_ID) const
EXPORT std::string SignContract(const std::string &SIGNER_NYM_ID, const std::string &THE_CONTRACT) const
EXPORT int32_t getInbox(const OTIdentifier &SERVER_ID, const OTIdentifier &USER_ID, const OTIdentifier &ACCT_ID) const
EXPORT OTClause * GetCallback(std::string str_CallbackName)
EXPORT std::string GetNym_Name(const std::string &NYM_ID) const
Returns Nym Name (based on NymID)
EXPORT std::string LoadPurse(const std::string &SERVER_ID, const std::string &ASSET_TYPE_ID, const std::string &USER_ID) const
EXPORT int32_t notarizeWithdrawal(const std::string &SERVER_ID, const std::string &USER_ID, const std::string &ACCT_ID, const int64_t &AMOUNT) const
EXPORT int32_t processInbox(const OTIdentifier &SERVER_ID, const OTIdentifier &USER_ID, const OTIdentifier &ACCT_ID, const OTString &ACCT_LEDGER) const
EXPORT std::string Message_GetPayload(const std::string &THE_MESSAGE) const
EXPORT int64_t Token_GetDenomination(const std::string &SERVER_ID, const std::string &ASSET_TYPE_ID, const std::string &THE_TOKEN) const
The actual cash value of the token. Returns a int64_t.
EXPORT void AddServerContract(const OTServerContract &theContract)
EXPORT std::string EasyProposePlan(const std::string &SERVER_ID, const std::string &DATE_RANGE, const std::string &SENDER_ACCT_ID, const std::string &SENDER_USER_ID, const std::string &PLAN_CONSIDERATION, const std::string &RECIPIENT_ACCT_ID, const std::string &RECIPIENT_USER_ID, const std::string &INITIAL_PAYMENT, const std::string &PAYMENT_PLAN, const std::string &PLAN_EXPIRY) const
EXPORT int32_t getMint(const std::string &SERVER_ID, const std::string &USER_ID, const std::string &ASSET_ID) const
EXPORT std::string LoadOutbox(const std::string &SERVER_ID, const std::string &USER_ID, const std::string &ACCOUNT_ID) const
EXPORT int32_t GetNym_OutmailCount(const std::string &NYM_ID) const
EXPORT void GetName(OTString &strName) const
EXPORT int32_t Token_GetSeries(const std::string &SERVER_ID, const std::string &ASSET_TYPE_ID, const std::string &THE_TOKEN) const
EXPORT bool RemoveOutmailByIndex(int32_t nIndex)
EXPORT bool VerifySignature(const OTString &strContract, const OTIdentifier &theSignerNymID, OTContract **ppContract=nullptr) const
EXPORT bool GetTransactionNum(int64_t &lOutput) const
EXPORT bool SetServer_Name(const OTIdentifier &SERVER_ID, const OTString &STR_NEW_NAME) const
EXPORT int32_t SmartContract_CountNumsNeeded(const std::string &THE_CONTRACT, const std::string &AGENT_NAME) const
EXPORT bool DoesBoxReceiptExist(const OTIdentifier &SERVER_ID, const OTIdentifier &USER_ID, const OTIdentifier &ACCOUNT_ID, int32_t nBoxType, const int64_t &lTransactionNum) const
EXPORT int32_t usageCredits(const std::string &SERVER_ID, const std::string &USER_ID, const std::string &USER_ID_CHECK, const int64_t &ADJUSTMENT) const
EXPORT uint64_t StringToUlong(const std::string &strNumber) const
EXPORT const OTAsymmetricKey & GetPublicEncrKey() const
EXPORT const OTString & GetCurrencyTLA() const
static EXPORT void SetAppBinaryFolder(OTString strLocation)
EXPORT bool PopMemlogFront() const
EXPORT OTWallet * GetWallet(const char *szFuncName=nullptr) const
EXPORT int32_t activateSmartContract(const OTIdentifier &SERVER_ID, const OTIdentifier &USER_ID, const OTString &THE_SMART_CONTRACT) const
EXPORT std::string GetAssetType_ID(const int32_t &nIndex) const
EXPORT bool AddBasketCreationItem(const OTIdentifier &USER_ID, Basket &theBasket, const OTIdentifier &ASSET_TYPE_ID, int64_t MINIMUM_TRANSFER) const
static EXPORT OTString GetMemlogAtIndex(int32_t nIndex)
EXPORT bool GetInboxHash(const std::string &acct_id, OTIdentifier &theOutput) const
EXPORT bool AddTransaction(OTTransaction &theTransaction)
EXPORT std::string Message_GetLedger(const std::string &THE_MESSAGE) const
EXPORT bool SetWallet(const std::string &strWalletFilename) const
EXPORT bool SetAccountWallet_Name(const std::string &ACCT_ID, const std::string &SIGNER_NYM_ID, const std::string &ACCT_NEW_NAME) const
EXPORT std::string NumList_Remove(const std::string &strNumList, const std::string &strNumbers) const
OTLOG_IMPORT OTLogStream otOut
EXPORT int64_t Basket_GetMemberMinimumTransferAmount(const std::string &BASKET_ASSET_TYPE_ID, const int32_t &nIndex) const
EXPORT int32_t getAccount(const std::string &SERVER_ID, const std::string &USER_ID, const std::string &ACCT_ID) const
EXPORT void AddAssetContract(const OTAssetContract &theContract)
EXPORT int32_t GetBasketMemberCount(const OTIdentifier &BASKET_ASSET_TYPE_ID) const
EXPORT bool Wallet_ChangePassphrase() const
EXPORT void GetNote(OTString &theStr) const
EXPORT bool LoadWallet() const
EXPORT std::string Basket_GetMemberType(const std::string &BASKET_ASSET_TYPE_ID, const int32_t &nIndex) const
EXPORT std::string LoadExpiredBox(const std::string &SERVER_ID, const std::string &USER_ID) const
EXPORT int32_t depositCheque(const OTIdentifier &SERVER_ID, const OTIdentifier &USER_ID, const OTIdentifier &ACCT_ID, const OTString &THE_CHEQUE) const
virtual EXPORT bool Compare(OTScriptable &rhs) const
EXPORT bool Wallet_ImportNym(const OTString &FILE_CONTENTS, OTIdentifier *pNymID=nullptr) const
EXPORT int32_t getInbox(const std::string &SERVER_ID, const std::string &USER_ID, const std::string &ACCT_ID) const
EXPORT int32_t killPaymentPlan(const std::string &SERVER_ID, const std::string &USER_ID, const std::string &FROM_ACCT_ID, const int64_t &TRANSACTION_NUMBER) const
EXPORT std::string Ledger_AddTransaction(const std::string &SERVER_ID, const std::string &USER_ID, const std::string &ACCOUNT_ID, const std::string &THE_LEDGER, const std::string &THE_TRANSACTION) const
Add a transaction to a ledger.
EXPORT time64_t Transaction_GetDateSigned(const std::string &SERVER_ID, const std::string &USER_ID, const std::string &ACCOUNT_ID, const std::string &THE_TRANSACTION) const
EXPORT int32_t processNymbox(const std::string &SERVER_ID, const std::string &USER_ID) const
EXPORT bool Nym_VerifyOutpaymentsByIndex(const std::string &NYM_ID, const int32_t &nIndex) const
int32_t GetAgentCount() const
EXPORT std::string Instrmnt_GetSenderUserID(const std::string &THE_INSTRUMENT) const
EXPORT std::string Message_GetNewIssuerAcctID(const std::string &THE_MESSAGE) const
EXPORT std::string Message_GetNewAssetTypeID(const std::string &THE_MESSAGE) const
EXPORT bool GetSenderUserIDForDisplay(OTIdentifier &theReturnID)
EXPORT int32_t getContract(const std::string &SERVER_ID, const std::string &USER_ID, const std::string &ASSET_ID) const
EXPORT int32_t getMarketList(const std::string &SERVER_ID, const std::string &USER_ID) const
Retrieves details for each market.
const OTIdentifier & GetAssetID() const
EXPORT bool Wallet_ExportCert(const OTIdentifier &NYM_ID, OTString &strOutput) const
EXPORT bool GetHooks(std::string str_HookName, mapOfClauses &theResults)
EXPORT int32_t GetClauseCount() const
EXPORT int32_t withdrawVoucher(const OTIdentifier &SERVER_ID, const OTIdentifier &USER_ID, const OTIdentifier &ACCT_ID, const OTIdentifier &RECIPIENT_USER_ID, const OTString &CHEQUE_MEMO, const int64_t &AMOUNT) const
EXPORT std::string ConfirmPaymentPlan(const std::string &SERVER_ID, const std::string &SENDER_USER_ID, const std::string &SENDER_ACCT_ID, const std::string &RECIPIENT_USER_ID, const std::string &PAYMENT_PLAN) const
EXPORT std::string Wallet_ExportCert(const std::string &NYM_ID) const
Returns the exported cert, if successful. Else nullptr.
EXPORT bool SaveContractRaw(OTString &strOutput) const
EXPORT bool FormatAmount(int64_t amount, std::string &str_output) const
static EXPORT int32_t GetMemlogSize()
EXPORT std::string LoadNymbox(const std::string &SERVER_ID, const std::string &USER_ID) const
EXPORT bool Peek(int64_t &lPeek) const
EXPORT uint32_t GetLength() const
bool IsExchanging() const
EXPORT bool StringToAmount(int64_t &amount, const std::string &str_input) const
std::map< std::string, OTClause * > mapOfClauses
EXPORT std::string LoadMint(const std::string &SERVER_ID, const std::string &ASSET_TYPE_ID) const
EXPORT int32_t withdrawVoucher(const std::string &SERVER_ID, const std::string &USER_ID, const std::string &ACCT_ID, const std::string &RECIPIENT_USER_ID, const std::string &CHEQUE_MEMO, const int64_t &AMOUNT) const
EXPORT bool GetAssetType(int32_t iIndex, OTIdentifier &THE_ID, OTString &THE_NAME) const
EXPORT bool GetRecentHash(const std::string &server_id, OTIdentifier &theOutput) const
EXPORT std::string Transaction_GetRecipientUserID(const std::string &SERVER_ID, const std::string &USER_ID, const std::string &ACCOUNT_ID, const std::string &THE_TRANSACTION) const
EXPORT std::string Instrmnt_GetRecipientAcctID(const std::string &THE_INSTRUMENT) const
EXPORT bool AddNewSubkey(const OTIdentifier &idMasterCredential, int32_t nBits=1024, const OTString::Map *pmapPrivate=nullptr, const OTPasswordData *pPWData=nullptr, OTString *pstrNewID=nullptr)
EXPORT void Sleep(const int64_t &MILLISECONDS) const
EXPORT bool SetAsciiArmoredData(const OTASCIIArmor &theArmoredText, bool bLineBreaks=true)
EXPORT int64_t Message_GetUsageCredits(const std::string &THE_MESSAGE) const
time64_t OTTimeGetTimeFromSeconds(int64_t seconds)
EXPORT std::string ProposePaymentPlan(const std::string &SERVER_ID, const time64_t &VALID_FROM, const time64_t &VALID_TO, const std::string &SENDER_ACCT_ID, const std::string &SENDER_USER_ID, const std::string &PLAN_CONSIDERATION, const std::string &RECIPIENT_ACCT_ID, const std::string &RECIPIENT_USER_ID, const int64_t &INITIAL_PAYMENT_AMOUNT, const time64_t &INITIAL_PAYMENT_DELAY, const int64_t &PAYMENT_PLAN_AMOUNT, const time64_t &PAYMENT_PLAN_DELAY, const time64_t &PAYMENT_PLAN_PERIOD, const time64_t &PAYMENT_PLAN_LENGTH, const int32_t &PAYMENT_PLAN_MAX_PAYMENTS) const
EXPORT std::string LoadAssetContract(const std::string &ASSET_TYPE_ID) const
EXPORT std::string LoadOutboxNoVerify(const std::string &SERVER_ID, const std::string &USER_ID, const std::string &ACCOUNT_ID) const
EXPORT bool Wallet_CanRemoveAccount(const std::string &ACCOUNT_ID) const
EXPORT bool GetAssetTypeID(OTIdentifier &theOutput) const
EXPORT bool VerifyAccountReceipt(const std::string &SERVER_ID, const std::string &NYM_ID, const std::string &ACCT_ID) const
EXPORT int32_t sendUserInstrument(const std::string &SERVER_ID, const std::string &USER_ID, const std::string &USER_ID_RECIPIENT, const std::string &RECIPIENT_PUBKEY, const std::string &THE_INSTRUMENT, const std::string &INSTRUMENT_FOR_SENDER) const
EXPORT std::string GetNym_MailSenderIDByIndex(const std::string &NYM_ID, const int32_t &nIndex) const
EXPORT const OTString & GetName() const
EXPORT bool IsInitialized() const
EXPORT bool GetInboxHash(OTIdentifier &output)
EXPORT std::string GetNym_OutmailServerIDByIndex(const std::string &NYM_ID, const int32_t &nIndex) const
EXPORT bool Open(const OTPseudonym &theRecipient, OTString &theOutput, const OTPasswordData *pPWData=nullptr)
EXPORT std::string Transaction_GetSenderAcctID(const std::string &SERVER_ID, const std::string &USER_ID, const std::string &ACCOUNT_ID, const std::string &THE_TRANSACTION) const
EXPORT bool NumList_Remove(OTNumList &theList, const OTNumList &theOldNumbers) const
EXPORT int64_t Transaction_GetDisplayReferenceToNum(const std::string &SERVER_ID, const std::string &USER_ID, const std::string &ACCOUNT_ID, const std::string &THE_TRANSACTION) const
EXPORT std::string Instrmnt_GetRemitterUserID(const std::string &THE_INSTRUMENT) const
EXPORT bool Wallet_CanRemoveServer(const std::string &SERVER_ID) const
EXPORT int64_t StringToLong(const std::string &strNumber) const
EXPORT OTPseudonym * GetOrLoadPrivateNym(const OTIdentifier &NYM_ID, bool bChecking=false, const char *szFuncName=nullptr, const OTPasswordData *pPWData=nullptr, const OTPassword *pImportPassword=nullptr) const
EXPORT bool DiscardCheque(const OTIdentifier &SERVER_ID, const OTIdentifier &USER_ID, const OTIdentifier &ACCT_ID, const OTString &THE_CHEQUE) const
EXPORT std::string AddSubcredential(const std::string &NYM_ID, const std::string &MASTER_CRED_ID, const int32_t &nKeySize) const
EXPORT int32_t GetTransactionCountInRefTo(int64_t lReferenceNum) const
const int64_t & GetRequestNum() const
EXPORT bool WalletExists() const
EXPORT int32_t GetTransactionNumCount(const OTIdentifier &theServerID) const
EXPORT bool VerifySignature(const std::string &SIGNER_NYM_ID, const std::string &THE_CONTRACT) const
EXPORT int32_t GetCallbackCount() const
EXPORT std::string GetNym_SourceForID(const std::string &NYM_ID) const
EXPORT std::string Callback_GetNameByIndex(const std::string &THE_CONTRACT, const std::string &BYLAW_NAME, const int32_t &nIndex) const
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) const
EXPORT int32_t getRequest(const OTIdentifier &SERVER_ID, const OTIdentifier &USER_ID) const
EXPORT bool RemoveSentMessage(const int64_t &lRequestNumber, const OTIdentifier &SERVER_ID, const OTIdentifier &USER_ID) const
EXPORT bool HarvestAllNumbers(const OTIdentifier &SERVER_ID, const OTIdentifier &NYM_ID, const OTString &THE_CRON_ITEM) const
EXPORT bool HaveAlreadySeenReply(const std::string &SERVER_ID, const std::string &USER_ID, const int64_t &REQUEST_NUMBER) const
EXPORT std::string Instrmnt_GetRemitterAcctID(const std::string &THE_INSTRUMENT) const
EXPORT std::string LoadServerContract(const std::string &SERVER_ID) const
static EXPORT OTItem * CreateItemFromTransaction(const OTTransaction &theOwner, OTItem::itemType theType, const OTIdentifier *pDestinationAcctID=nullptr)
EXPORT std::string LoadPubkey_Signing(const std::string &USER_ID) const
EXPORT std::string LoadRecordBoxNoVerify(const std::string &SERVER_ID, const std::string &USER_ID, const std::string &ACCOUNT_ID) const
EXPORT void ReleaseSignatures()
EXPORT bool Exists() const
EXPORT const std::string GetHookNameByIndex(int32_t nIndex)
EXPORT std::string SmartContract_AddCallback(const std::string &THE_CONTRACT, const std::string &SIGNER_NYM_ID, const std::string &BYLAW_NAME, const std::string &CALLBACK_NAME, const std::string &CLAUSE_NAME) const
EXPORT std::string SmartContract_AddAccount(const std::string &THE_CONTRACT, const std::string &SIGNER_NYM_ID, const std::string &PARTY_NAME, const std::string &ACCT_NAME, const std::string &ASSET_TYPE_ID) const
EXPORT bool RemoveAssetContract(const OTIdentifier &theTargetID)
EXPORT OTClause * GetClause(std::string str_Name) const
EXPORT void SetString(const char *szString)
EXPORT bool GetAccount(int32_t iIndex, OTIdentifier &THE_ID, OTString &THE_NAME) const
EXPORT std::string GenerateBasketExchange(const std::string &SERVER_ID, const std::string &USER_ID, const std::string &BASKET_ASSET_TYPE_ID, const std::string &BASKET_ASSET_ACCT_ID, const int32_t &TRANSFER_MULTIPLE) const
EXPORT int32_t GetMailCount() const
return the number of mail items available for this Nym.
EXPORT bool GetServer(int32_t iIndex, OTIdentifier &THE_ID, OTString &THE_NAME) const
EXPORT bool GetBasketMemberType(const OTIdentifier &BASKET_ASSET_TYPE_ID, int32_t nIndex, OTIdentifier &theOutputMemberType) const
EXPORT int32_t SmartContract_CountNumsNeeded(const OTString &THE_CONTRACT, const OTString &AGENT_NAME) const
EXPORT const OTCredential * GetRevokedCredentialByIndex(int32_t nIndex) const
EXPORT std::string Ledger_GetTransactionByID(const std::string &SERVER_ID, const std::string &USER_ID, const std::string &ACCOUNT_ID, const std::string &THE_LEDGER, const int64_t &TRANSACTION_NUMBER) const
EXPORT std::string Instrmnt_GetServerID(const std::string &THE_INSTRUMENT) const
EXPORT std::string Party_GetAcctAgentName(const std::string &THE_CONTRACT, const std::string &PARTY_NAME, const std::string &ACCT_NAME) const
static EXPORT bool PopMemlogFront()
EXPORT int32_t depositPaymentPlan(const OTIdentifier &SERVER_ID, const OTIdentifier &USER_ID, const OTString &THE_PAYMENT_PLAN) const
const char * GetTypeString() const
EXPORT bool GetRecipientAcctID(OTIdentifier &theOutput) const
EXPORT bool RemoveNym(const OTIdentifier &theTargetID)
EXPORT int32_t Purse_Count(const std::string &SERVER_ID, const std::string &ASSET_TYPE_ID, const std::string &THE_PURSE) const
returns a count of the number of cash tokens inside this purse.
EXPORT bool SetNym_Name(const std::string &NYM_ID, const std::string &SIGNER_NYM_ID, const std::string &NYM_NEW_NAME) const
EXPORT void Format(const char *fmt,...)
EXPORT OTTransaction * GetReplyNotice(const int64_t &lRequestNum)
EXPORT bool Msg_HarvestTransactionNumbers(const std::string &THE_MESSAGE, const std::string &USER_ID, const bool &bHarvestingForRetry, const bool &bReplyWasSuccess, const bool &bReplyWasFailure, const bool &bTransactionWasSuccess, const bool &bTransactionWasFailure) const
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) const
EXPORT std::string Party_GetAcctID(const std::string &THE_CONTRACT, const std::string &PARTY_NAME, const std::string &ACCT_NAME) const
EXPORT const std::string GetCallbackNameByIndex(int32_t nIndex)
EXPORT const OTString & GetName() const
EXPORT bool SwitchWallet() const
static EXPORT bool Decrypt(const OTString &strKey, OTString &strCiphertext, OTString &strOutput, const OTString *pstrDisplay=nullptr, const OTPassword *pAlreadyHavePW=nullptr)
EXPORT int32_t GetOutpaymentsCount() const
return the number of payments items available for this Nym.
EXPORT std::string LoadExpiredBoxNoVerify(const std::string &SERVER_ID, const std::string &USER_ID) const
EXPORT int32_t GetAccountCount() const
EXPORT std::string GetNym_ActiveCronItemIDs(const std::string &NYM_ID, const std::string &SERVER_ID) const
EXPORT const OTPseudonym * GetContractPublicNym() const
EXPORT bool Compare(const char *compare) const
EXPORT const OTString & GetName()
EXPORT int32_t depositPaymentPlan(const std::string &SERVER_ID, const std::string &USER_ID, const std::string &THE_PAYMENT_PLAN) const
EXPORT std::string Clause_GetContents(const std::string &THE_CONTRACT, const std::string &BYLAW_NAME, const std::string &CLAUSE_NAME) const
EXPORT std::string LoadInbox(const std::string &SERVER_ID, const std::string &USER_ID, const std::string &ACCOUNT_ID) const
EXPORT OTItem * GetItem(OTItem::itemType theType)
EXPORT std::string LongToString(const int64_t &lNumber) const
EXPORT std::string GetNym_RecentHash(const std::string &SERVER_ID, const std::string &NYM_ID) const
EXPORT bool LoadWallet() const
EXPORT std::string Variable_GetType(const std::string &THE_CONTRACT, const std::string &BYLAW_NAME, const std::string &VARIABLE_NAME) const
EXPORT bool Nym_VerifyOutmailByIndex(const std::string &NYM_ID, const int32_t &nIndex) const
EXPORT int64_t Instrmnt_GetTransNum(const std::string &THE_INSTRUMENT) const
const OTIdentifier & GetPurportedServerID() const
EXPORT std::string Token_GetServerID(const std::string &THE_TOKEN) const
EXPORT const OTString & GetMasterCredID() const
EXPORT std::string Instrmnt_GetRecipientUserID(const std::string &THE_INSTRUMENT) const
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) const
Find out how many pending transactions (and receipts) are in this inbox.
EXPORT int32_t Party_GetAcctCount(const std::string &THE_CONTRACT, const std::string &PARTY_NAME) const
EXPORT bool GetPaymentContents(OTString &strOutput) const
EXPORT void Set(const char *data, uint32_t enforcedMaxLength=0)
EXPORT bool SetTransportCallback(TransportCallback *pTransportCallback)
EXPORT std::string GetNym_SubCredentialID(const std::string &NYM_ID, const std::string &MASTER_CRED_ID, const int32_t &nIndex) const
EXPORT int32_t deleteAssetAccount(const OTIdentifier &SERVER_ID, const OTIdentifier &USER_ID, const OTIdentifier &ACCOUNT_ID) const
EXPORT std::string Wallet_GetAssetIDFromPartial(const std::string &PARTIAL_ID) const
EXPORT std::string SmartContract_AddHook(const std::string &THE_CONTRACT, const std::string &SIGNER_NYM_ID, const std::string &BYLAW_NAME, const std::string &HOOK_NAME, const std::string &CLAUSE_NAME) const
EXPORT bool GetSenderUserID(OTIdentifier &theOutput) const
EXPORT bool LoadLedgerFromString(const OTString &theStr)
EXPORT bool Mint_IsStillGood(const std::string &SERVER_ID, const std::string &ASSET_TYPE_ID) const
EXPORT std::string GetNym_ID(const int32_t &nIndex) const
based on Index this returns the Nym's ID
EXPORT bool GetMemo(OTString &strOutput) const
EXPORT bool AddTransactionNum(OTPseudonym &SIGNER_NYM, const OTString &strServerID, int64_t lTransNum, bool bSave)
OTTransaction * LoadBoxReceipt(OTTransaction &theAbbrev, OTLedger &theLedger)
EXPORT int32_t getTransactionNumber(const std::string &SERVER_ID, const std::string &USER_ID) const
EXPORT bool Wallet_ImportCert(const OTString &DISPLAY_NAME, const OTString &FILE_CONTENTS, OTIdentifier *pNymID=nullptr) const
EXPORT bool Wallet_CanRemoveNym(const std::string &NYM_ID) const
EXPORT int64_t ReplyNotice_GetRequestNum(const std::string &SERVER_ID, const std::string &USER_ID, const std::string &THE_TRANSACTION) const
Transactions do not have request numbers. However, if you have a.
EXPORT std::string FlatSign(const std::string &SIGNER_NYM_ID, const std::string &THE_INPUT, const std::string &CONTRACT_TYPE) const
EXPORT std::string GetNym_OutpaymentsServerIDByIndex(const std::string &NYM_ID, const int32_t &nIndex) const
EXPORT bool GetPublicKey(OTASCIIArmor &strKey) const
EXPORT bool Wallet_CanRemoveAssetType(const std::string &ASSET_ID) const
EXPORT const char * GetCode() const
static EXPORT bool Encrypt(const OTString &strKey, const OTString &strPlaintext, OTString &strOutput, const OTString *pstrDisplay=nullptr, bool bBookends=true, const OTPassword *pAlreadyHavePW=nullptr)
EXPORT OTPseudonym * GetNymByIDPartialMatch(const std::string PARTIAL_ID, const char *szFuncName=nullptr) const
static EXPORT OTString PeekMemlogBack()
EXPORT bool Msg_HarvestTransactionNumbers(const OTMessage &theMsg, const OTIdentifier &USER_ID, bool bHarvestingForRetry, bool bReplyWasSuccess, bool bReplyWasFailure, bool bTransactionWasSuccess, bool bTransactionWasFailure) const
static EXPORT void SetHomeFolder(OTString strLocation)
EXPORT int32_t GetAccountCount() const
EXPORT bool Output(std::set< int64_t > &theOutput) const
EXPORT int64_t GetClosingNum() const
EXPORT std::string Wallet_GetNymIDFromPartial(const std::string &PARTIAL_ID) const
Attempts to find a full ID in the wallet, based on a partial of the same.
EXPORT std::string GetServer_Name(const std::string &SERVER_ID) const
EXPORT bool RemoveIssuedNum(OTPseudonym &SIGNER_NYM, const OTString &strServerID, const int64_t &lTransNum, bool bSave)
bool FlatSign(const OTIdentifier &theSignerNymID, const OTString &strInput, const OTString &strContractType, OTString &strOutput) const
EXPORT std::string LoadNymboxNoVerify(const std::string &SERVER_ID, const std::string &USER_ID) const
EXPORT std::string Decrypt(const std::string &RECIPIENT_NYM_ID, const std::string &strCiphertext) const
EXPORT std::string Decode(const std::string &strEncoded, const bool &bLineBreaks) const
EXPORT std::string GetNym_OutboxHash(const std::string &ACCOUNT_ID, const std::string &NYM_ID) const
EXPORT int32_t GetOutmailCount() const
return the number of mail items available for this Nym.
EXPORT int32_t GetNym_OutpaymentsCount(const std::string &NYM_ID) const
EXPORT std::string SmartContract_ConfirmParty(const std::string &THE_CONTRACT, const std::string &PARTY_NAME, const std::string &NYM_ID) const
EXPORT int32_t checkServerID(const std::string &SERVER_ID, const std::string &USER_ID) const
EXPORT OTMessage * GetOutmailByIndex(int32_t nIndex) const
int64_t GetTotalValue() const
EXPORT int32_t depositCheque(const std::string &SERVER_ID, const std::string &USER_ID, const std::string &ACCT_ID, const std::string &THE_CHEQUE) const
EXPORT std::string SmartContract_AddClause(const std::string &THE_CONTRACT, const std::string &SIGNER_NYM_ID, const std::string &BYLAW_NAME, const std::string &CLAUSE_NAME, const std::string &SOURCE_CODE) const
EXPORT bool RemoveSentMessage(const int64_t &REQUEST_NUMBER, const std::string &SERVER_ID, const std::string &USER_ID) const
EXPORT int32_t checkUser(const std::string &SERVER_ID, const std::string &USER_ID, const std::string &USER_ID_CHECK) const
EXPORT std::string LoadUserPubkey_Encryption(const std::string &USER_ID) const
EXPORT std::string GetAccountWallet_ServerID(const std::string &ACCOUNT_ID) const
EXPORT bool RemoveMailByIndex(int32_t nIndex)
EXPORT std::string LoadPaymentInbox(const std::string &SERVER_ID, const std::string &USER_ID) const
EXPORT bool RevokeSubcredential(const std::string &NYM_ID, const std::string &MASTER_CRED_ID, const std::string &SUB_CRED_ID) const
EXPORT int32_t getMarketList(const OTIdentifier &SERVER_ID, const OTIdentifier &USER_ID) const
EXPORT int32_t getMarketOffers(const std::string &SERVER_ID, const std::string &USER_ID, const std::string &MARKET_ID, const int64_t &MAX_DEPTH) const
Gets all offers for a specific market and their details (up until.
EXPORT bool Purse_HasPassword(const std::string &SERVER_ID, const std::string &THE_PURSE) const
OTPayment * GetInstrument(const OTPseudonym &theNym, const int32_t &nIndex, OTLedger &ledger)
EXPORT std::string Wallet_ExportNym(const std::string &NYM_ID) const
Returns the exported Nym, if success. (Else nullptr.)
EXPORT int32_t getOutbox(const OTIdentifier &SERVER_ID, const OTIdentifier &USER_ID, const OTIdentifier &ACCT_ID) const
EXPORT bool Wallet_RemoveServer(const std::string &SERVER_ID) const
EXPORT std::string GetNym_AltSourceLocation(const std::string &NYM_ID) const
static EXPORT OTLedger * GenerateLedger(const OTIdentifier &theUserID, const OTIdentifier &theAcctID, const OTIdentifier &theServerID, ledgerType theType, bool bCreateFile=false)
EXPORT bool Nym_RemoveOutpaymentsByIndex(const std::string &NYM_ID, const int32_t &nIndex) const
void FlushMessageBuffer()
EXPORT bool NumList_VerifyAll(const OTNumList &theList, const OTNumList &theQueryNumbers) const
OTLOG_IMPORT OTLogStream otInfo
EXPORT int32_t NumList_Count(const std::string &strNumList) const
EXPORT OTParty * GetParty(std::string str_party_name) const
EXPORT bool CompareID(const OTIdentifier &theIdentifier) const
static EXPORT bool SleepMilliseconds(int64_t lMilliseconds)
EXPORT std::string CalculateAssetContractID(const std::string &str_Contract) const
EXPORT OTTransaction * GetTransactionByIndex(int32_t nIndex) const
EXPORT std::string CreateNym(const int32_t &nKeySize, const std::string &NYM_ID_SOURCE, const std::string &ALT_LOCATION) const
EXPORT int32_t Count() const
EXPORT bool IsRegisteredAtServer(const OTString &strServerID) const
const OTString & GetAgentName() const
EXPORT const OTString & GetPubCredential() const
EXPORT bool Wallet_ChangePassphrase() const
EXPORT bool SaveWallet(const char *szFilename=nullptr)
EXPORT std::string AddBasketCreationItem(const std::string &USER_ID, const std::string &THE_BASKET, const std::string &ASSET_TYPE_ID, const int64_t &MINIMUM_TRANSFER) const
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) const
EXPORT const OTString & GetAltLocation() const
virtual EXPORT void GetIdentifier(OTIdentifier &theIdentifier) const
EXPORT int32_t notarizeWithdrawal(const OTIdentifier &SERVER_ID, const OTIdentifier &USER_ID, const OTIdentifier &ACCT_ID, const int64_t &AMOUNT) const
EXPORT bool Smart_IsPartyConfirmed(const std::string &THE_CONTRACT, const std::string &PARTY_NAME) const
EXPORT std::string GetPartyID(bool *pBoolSuccess=nullptr) const
EXPORT int32_t GetNym_CredentialCount(const std::string &NYM_ID) const
static EXPORT bool GetActiveCronTransNums(OTNumList &output, const OTIdentifier &nymID, const OTIdentifier &serverID)
EXPORT std::string CreatePurse_Passphrase(const std::string &SERVER_ID, const std::string &ASSET_TYPE_ID, const std::string &SIGNER_ID) const
EXPORT int32_t Bylaw_GetCallbackCount(const std::string &THE_CONTRACT, const std::string &BYLAW_NAME) const
EXPORT bool GetSenderAcctID(OTIdentifier &theOutput) const
EXPORT OTCredential * GetRevokedCredential(const OTString &strID)
EXPORT bool SetAssetType_Name(const std::string &ASSET_ID, const std::string &STR_NEW_NAME) const
EXPORT time64_t Instrmnt_GetValidTo(const std::string &THE_INSTRUMENT) const
EXPORT std::string Hook_GetNameByIndex(const std::string &THE_CONTRACT, const std::string &BYLAW_NAME, const int32_t &nIndex) const
EXPORT std::string LoadPaymentInboxNoVerify(const std::string &SERVER_ID, const std::string &USER_ID) const
EXPORT int32_t activateSmartContract(const std::string &SERVER_ID, const std::string &USER_ID, const std::string &THE_SMART_CONTRACT) const
EXPORT bool IsNym_RegisteredAtServer(const OTIdentifier &NYM_ID, const OTIdentifier &SERVER_ID) const
EXPORT bool DoesBoxReceiptExist(const std::string &SERVER_ID, const std::string &USER_ID, const std::string &ACCOUNT_ID, const int32_t &nBoxType, const int64_t &TRANSACTION_NUMBER) const
EXPORT OTVariable * GetVariable(std::string str_Name)
EXPORT std::string Instrmnt_GetSenderAcctID(const std::string &THE_INSTRUMENT) const
EXPORT int32_t GetNym_TransactionNumCount(const std::string &SERVER_ID, const std::string &NYM_ID) const
EXPORT std::string GetNym_CredentialContents(const std::string &NYM_ID, const std::string &CREDENTIAL_ID) const
EXPORT std::string GetNym_NymboxHash(const std::string &SERVER_ID, const std::string &NYM_ID) const
EXPORT std::string Smart_GetBylawByIndex(const std::string &THE_CONTRACT, const int32_t &nIndex) const
returns the name of the bylaw.
time64_t GetDateSigned() const
EXPORT int64_t Instrmnt_GetAmount(const std::string &THE_INSTRUMENT) const
EXPORT int32_t Message_GetTransactionSuccess(const std::string &SERVER_ID, const std::string &USER_ID, const std::string &ACCOUNT_ID, const std::string &THE_MESSAGE) const
EXPORT bool IsCancelled()
static EXPORT OTCronItem * LoadActiveCronReceipt(const int64_t &lTransactionNum, const OTIdentifier &serverID)
EXPORT void SetNote(const OTString &theStr)
EXPORT std::string Token_GetAssetID(const std::string &THE_TOKEN) const
EXPORT const OTAsymmetricKey & GetPublicSignKey() const
EXPORT bool GetNymboxHash(const std::string &server_id, OTIdentifier &theOutput) const
EXPORT int32_t notarizeDeposit(const OTIdentifier &SERVER_ID, const OTIdentifier &USER_ID, const OTIdentifier &ACCT_ID, const OTString &THE_PURSE) const
EXPORT int64_t GetReferenceToNum() const
EXPORT bool SetTempValues()
EXPORT std::string AddBasketExchangeItem(const std::string &SERVER_ID, const std::string &USER_ID, const std::string &THE_BASKET, const std::string &ASSET_TYPE_ID, const std::string &ASSET_ACCT_ID) const
EXPORT bool Nym_RemoveOutmailByIndex(const std::string &NYM_ID, const int32_t &nIndex) const
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) const
EXPORT bool GetOutboxHash(OTIdentifier &output)
EXPORT bool GetOutboxHash(const std::string &acct_id, OTIdentifier &theOutput) const
EXPORT OTMessage * GetSentMessage(const int64_t &lRequestNumber, const OTIdentifier &SERVER_ID, const OTIdentifier &USER_ID) const
EXPORT size_t GetSubcredentialCount() const
EXPORT std::string Wallet_ImportNym(const std::string &FILE_CONTENTS) const
returns NymID if success, else nullptr.
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) const
EXPORT std::string LoadUserPubkey_Signing(const std::string &USER_ID) const
EXPORT const char * GetTypeString() const
EXPORT int32_t getAccountFiles(const OTIdentifier &SERVER_ID, const OTIdentifier &USER_ID, const OTIdentifier &ACCT_ID) const
EXPORT void FlushSentMessages(bool bHarvestingForRetry, const OTIdentifier &SERVER_ID, const OTIdentifier &USER_ID, const OTLedger &THE_NYMBOX) const
OTLOG_IMPORT OTLogStream otWarn
EXPORT int64_t GetReferenceNumForDisplay()
EXPORT bool WalletExists() const
EXPORT int32_t getRequest(const std::string &SERVER_ID, const std::string &USER_ID) const
EXPORT void HarvestClosingNumbers(OTPseudonym &theNym, const OTIdentifier &theServerID, bool bSave=true)
EXPORT bool NumList_VerifyQuery(const OTNumList &theList, const OTNumList &theQueryNumbers) const
EXPORT std::string LoadInboxNoVerify(const std::string &SERVER_ID, const std::string &USER_ID, const std::string &ACCOUNT_ID) const
These versions don't verify the ledger, they just load it up.
EXPORT const char * Get() const
EXPORT int32_t Message_IsTransactionCanceled(const std::string &SERVER_ID, const std::string &USER_ID, const std::string &ACCOUNT_ID, const std::string &THE_MESSAGE) const
EXPORT std::string GetAccountWallet_Name(const std::string &ACCOUNT_ID) const
EXPORT int32_t createUserAccount(const OTIdentifier &SERVER_ID, const OTIdentifier &USER_ID) const
transactionType GetType() const
virtual EXPORT bool SignContract(const OTPseudonym &theNym, const OTPasswordData *pPWData=nullptr)
EXPORT bool SavePurse(const std::string &SERVER_ID, const std::string &ASSET_TYPE_ID, const std::string &USER_ID, const std::string &THE_PURSE) const
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) const
Should handle duplicates. Should load, merge, and save.
EXPORT bool IsAnIndividual() const
OTLOG_IMPORT OTLogStream otErr
OTItem::itemStatus GetStatus() const
EXPORT std::string GetNym_MailServerIDByIndex(const std::string &NYM_ID, const int32_t &nIndex) const
EXPORT int64_t GetReceiptAmount()
EXPORT bool Decrypt(const OTIdentifier &theRecipientNymID, const OTString &strCiphertext, OTString &strOutput) const
EXPORT int32_t exchangeBasket(const std::string &SERVER_ID, const std::string &USER_ID, const std::string &BASKET_ASSET_ID, const std::string &THE_BASKET, const bool &BOOL_EXCHANGE_IN_OR_OUT) const
EXPORT OTPartyAccount * GetAccount(const std::string &str_acct_name) const
EXPORT int64_t GetTransactionNum() const
EXPORT int32_t Message_GetBalanceAgreementSuccess(const std::string &SERVER_ID, const std::string &USER_ID, const std::string &ACCOUNT_ID, const std::string &THE_MESSAGE) const
EXPORT int32_t notarizeTransfer(const std::string &SERVER_ID, const std::string &USER_ID, const std::string &ACCT_FROM, const std::string &ACCT_TO, const int64_t &AMOUNT, const std::string &NOTE) const
EXPORT void DisplayStatistics(OTString &strOutput)
EXPORT bool IsNym_RegisteredAtServer(const std::string &NYM_ID, const std::string &SERVER_ID) const
EXPORT bool SetWalletFilename(const OTString &strPath)
EXPORT std::string Nymbox_GetReplyNotice(const std::string &SERVER_ID, const std::string &USER_ID, const int64_t &REQUEST_NUMBER) const
EXPORT std::string Ledger_CreateResponse(const std::string &SERVER_ID, const std::string &USER_ID, const std::string &ACCOUNT_ID, const std::string &ORIGINAL_LEDGER) const
Creates a new 'response' ledger, set up with the right Server ID, etc,.
EXPORT void SetAppBinaryFolder(const std::string &strFolder) const
EXPORT bool Wallet_RemoveNym(const std::string &NYM_ID) const
EXPORT bool GetValidTo(time64_t &tOutput) const
EXPORT std::string Variable_GetAccess(const std::string &THE_CONTRACT, const std::string &BYLAW_NAME, const std::string &VARIABLE_NAME) const
EXPORT bool ConfirmPaymentPlan(const OTIdentifier &SERVER_ID, const OTIdentifier &SENDER_USER_ID, const OTIdentifier &SENDER_ACCT_ID, const OTIdentifier &RECIPIENT_USER_ID, OTPaymentPlan &thePlan) const
const OTString & GetAcctID() const
EXPORT void SetReferenceToNum(int64_t lTransactionNum)
EXPORT int32_t getNymbox(const OTIdentifier &SERVER_ID, const OTIdentifier &USER_ID) const
EXPORT const OTCredential * GetMasterCredentialByIndex(int32_t nIndex) const
EXPORT void zeroMemory() const
EXPORT bool IsValid() const
EXPORT std::string Party_GetAgentNameByIndex(const std::string &THE_CONTRACT, const std::string &PARTY_NAME, const int32_t &nIndex) const
EXPORT std::string PopMessageBuffer(const int64_t &REQUEST_NUMBER, const std::string &SERVER_ID, const std::string &USER_ID) const
EXPORT int32_t Bylaw_GetHookCount(const std::string &THE_CONTRACT, const std::string &BYLAW_NAME) const
OTASCIIArmor m_ascPayload
EXPORT const OTString & GetName() const
EXPORT size_t GetRevokedCredentialCount() const
const OTString & GetAssetTypeID() const
bool IsAbbreviated() const
EXPORT std::string GetNym_CredentialID(const std::string &NYM_ID, const int32_t &nIndex) const
EXPORT int32_t createUserAccount(const std::string &SERVER_ID, const std::string &USER_ID) const
EXPORT const char * GetLanguage() const
EXPORT int32_t Bylaw_GetVariableCount(const std::string &THE_CONTRACT, const std::string &BYLAW_NAME) const
EXPORT bool RemoveOutpaymentsByIndex(int32_t nIndex, bool bDeleteIt=true)
EXPORT int32_t getOutbox(const std::string &SERVER_ID, const std::string &USER_ID, const std::string &ACCT_ID) const
EXPORT const OTString & GetPubCredential() const
EXPORT int64_t Purse_GetTotalValue(const std::string &SERVER_ID, const std::string &ASSET_TYPE_ID, const std::string &THE_PURSE) const
Get Purse Total Value (internally uses GetTotalValue().)
EXPORT bool SetAssetType_Name(const OTIdentifier &ASSET_ID, const OTString &STR_NEW_NAME) const
EXPORT void GetString(OTString &theStr) const
EXPORT time64_t GetTime() const
EXPORT std::string GetAccountWallet_NymID(const std::string &ACCOUNT_ID) const
EXPORT int32_t GetVariableCount() const
EXPORT std::string FormatAmount(const std::string &ASSET_TYPE_ID, const int64_t &THE_AMOUNT) const
EXPORT int32_t Message_GetSuccess(const std::string &THE_MESSAGE) const
EXPORT std::string LoadAssetAccount(const std::string &SERVER_ID, const std::string &USER_ID, const std::string &ACCOUNT_ID) const
EXPORT std::string Message_GetNymboxHash(const std::string &THE_MESSAGE) const
bool Wallet_ImportPurse(const OTIdentifier &SERVER_ID, const OTIdentifier &ASSET_TYPE_ID, const OTIdentifier &SIGNER_ID, const OTString &THE_PURSE, const OTString *pstrDisplay=nullptr)
EXPORT std::string GetNym_OutmailRecipientIDByIndex(const std::string &NYM_ID, const int32_t &nIndex) const
EXPORT int32_t getNymbox(const std::string &SERVER_ID, const std::string &USER_ID) const
EXPORT std::string Token_GetID(const std::string &SERVER_ID, const std::string &ASSET_TYPE_ID, const std::string &THE_TOKEN) const
const OTString & GetMySignedCopy()
EXPORT bool SignContract(const OTIdentifier &theSignerNymID, const OTString &strContract, OTString &strOutput) const
EXPORT void FlushSentMessages(const bool &bHarvestingForRetry, const std::string &SERVER_ID, const std::string &USER_ID, const std::string &THE_NYMBOX) const
EXPORT int32_t payDividend(const std::string &SERVER_ID, const std::string &ISSUER_USER_ID, const std::string &DIVIDEND_FROM_ACCT_ID, const std::string &SHARES_ASSET_TYPE_ID, const std::string &DIVIDEND_MEMO, const int64_t &AMOUNT_PER_SHARE) const
PAY DIVIDEND – to shareholders.
EXPORT std::string Transaction_GetRecipientAcctID(const std::string &SERVER_ID, const std::string &USER_ID, const std::string &ACCOUNT_ID, const std::string &THE_TRANSACTION) const
EXPORT const OTString & GetNymIDSource() const
int32_t GetAccountCount() const
EXPORT int32_t Transaction_GetSuccess(const std::string &SERVER_ID, const std::string &USER_ID, const std::string &ACCOUNT_ID, const std::string &THE_TRANSACTION) const
EXPORT std::string SymmetricDecrypt(const std::string &SYMMETRIC_KEY, const std::string &CIPHERTEXT_ENVELOPE) const
EXPORT int32_t getMarketRecentTrades(const std::string &SERVER_ID, const std::string &USER_ID, const std::string &MARKET_ID) const
Gets all recent trades (up until maximum depth)
EXPORT bool Contains(const char *compare) const
EXPORT OTAssetContract * GetAssetContractPartialMatch(const std::string PARTIAL_ID, const char *szFuncName=nullptr) const
static EXPORT Token * TokenFactory(OTString strInput)
EXPORT int32_t GetMemlogSize() const
EXPORT int32_t createAssetAccount(const std::string &SERVER_ID, const std::string &USER_ID, const std::string &ASSET_ID) const
EXPORT bool NumList_VerifyAll(const std::string &strNumList, const std::string &strNumbers) const
EXPORT int32_t GetAssetTypeCount() const
EXPORT int64_t GetAccountWallet_Balance(const std::string &ACCOUNT_ID) const
EXPORT bool NumList_VerifyQuery(const std::string &strNumList, const std::string &strNumbers) const
EXPORT std::string WriteCheque(const std::string &SERVER_ID, const int64_t &CHEQUE_AMOUNT, const time64_t &VALID_FROM, const time64_t &VALID_TO, const std::string &SENDER_ACCT_ID, const std::string &SENDER_USER_ID, const std::string &CHEQUE_MEMO, const std::string &RECIPIENT_USER_ID) const
EXPORT int32_t getBoxReceipt(const OTIdentifier &SERVER_ID, const OTIdentifier &USER_ID, const OTIdentifier &ACCOUNT_ID, int32_t nBoxType, const int64_t &lTransactionNum) const
EXPORT int32_t GetNym_MailCount(const std::string &NYM_ID) const
OTItem::itemType GetType() const
EXPORT int64_t StringToAmount(const std::string &ASSET_TYPE_ID, const std::string &str_input) const
EXPORT int32_t checkUser(const OTIdentifier &SERVER_ID, const OTIdentifier &USER_ID, const OTIdentifier &USER_ID_CHECK) const
static EXPORT std::string & trim(std::string &str)
EXPORT std::string GetNym_RevokedCredContents(const std::string &NYM_ID, const std::string &CREDENTIAL_ID) const
EXPORT std::string Message_GetCommand(const std::string &THE_MESSAGE) const
const OTIdentifier & GetUserID() const
EXPORT std::string Instrmnt_GetMemo(const std::string &THE_INSTRUMENT) const
EXPORT std::string Instrmnt_GetType(const std::string &THE_INSTRUMENT) const
bool Contains(const OTString &strContains)
EXPORT bool GetString(OTString &theData, bool bLineBreaks=true) const
EXPORT int32_t getNym_MarketOffers(const OTIdentifier &SERVER_ID, const OTIdentifier &USER_ID) const
EXPORT bool LoadContractFromString(const OTString &theStr)
std::string & GetValueString()
EXPORT int32_t processNymbox(const OTIdentifier &SERVER_ID, const OTIdentifier &USER_ID) const
EXPORT int32_t deleteUserAccount(const std::string &SERVER_ID, const std::string &USER_ID) const
EXPORT OTPartyAccount * GetAccountByIndex(int32_t nIndex)
EXPORT std::string GetNym_Stats(const std::string &NYM_ID) const
EXPORT bool GetNym(int32_t iIndex, OTIdentifier &NYM_ID, OTString &NYM_NAME) const
EXPORT std::string Encode(const std::string &strPlaintext, const bool &bLineBreaks) const
int32_t & GetValueInteger()
EXPORT int64_t GetIssuedNum(const OTIdentifier &theServerID, int32_t nIndex) const
EXPORT int32_t GetNymCount() const
EXPORT OTAccount * GetAccountPartialMatch(const std::string PARTIAL_ID, const char *szFuncName=nullptr) const
EXPORT std::string GetAssetType_Contract(const std::string &ASSET_TYPE_ID) const
EXPORT OTMessage * GetOutpaymentsByIndex(int32_t nIndex) const
EXPORT int32_t deleteAssetAccount(const std::string &SERVER_ID, const std::string &USER_ID, const std::string &ACCOUNT_ID) const
EXPORT OTVariable * GetVariableByIndex(int32_t nIndex)
EXPORT int32_t Bylaw_GetClauseCount(const std::string &THE_CONTRACT, const std::string &BYLAW_NAME) const
void GetTypeString(OTString &strType) const
virtual EXPORT void CalculateContractID(OTIdentifier &newID) const
EXPORT OTServerContract * GetServerContractPartialMatch(const std::string PARTIAL_ID, const char *szFuncName=nullptr) const
EXPORT std::string GetAccountWallet_ID(const int32_t &nIndex) const
EXPORT bool Wallet_RemoveAssetType(const std::string &ASSET_ID) const
EXPORT std::string GetAccountWallet_Type(const std::string &ACCOUNT_ID) const
EXPORT int64_t Ledger_GetTransactionIDByIndex(const std::string &SERVER_ID, const std::string &USER_ID, const std::string &ACCOUNT_ID, const std::string &THE_LEDGER, const int32_t &nIndex) const
EXPORT size_t GetMasterCredentialCount() const
EXPORT bool NumList_Add(OTNumList &theList, const OTNumList &theNewNumbers) const
EXPORT bool AddIssuedNum(const OTString &strServerID, const int64_t &lTransNum)
EXPORT int32_t Basket_GetMemberCount(const std::string &BASKET_ASSET_TYPE_ID) const
listOfItems & GetItemList()
virtual EXPORT int64_t GetNumberOfOrigin()
EXPORT std::string Callback_GetClause(const std::string &THE_CONTRACT, const std::string &BYLAW_NAME, const std::string &CALLBACK_NAME) const
EXPORT bool GetRecipientUserID(OTIdentifier &theOutput) const
EXPORT std::string GetNym_InboxHash(const std::string &ACCOUNT_ID, const std::string &NYM_ID) const
EXPORT bool GetRemitterUserID(OTIdentifier &theOutput) const
EXPORT int32_t Hook_GetClauseCount(const std::string &THE_CONTRACT, const std::string &BYLAW_NAME, const std::string &HOOK_NAME) const
Returns the number of clauses attached to a specific hook.
EXPORT std::string SmartContract_AddVariable(const std::string &THE_CONTRACT, const std::string &SIGNER_NYM_ID, const std::string &BYLAW_NAME, const std::string &VAR_NAME, const std::string &VAR_ACCESS, const std::string &VAR_TYPE, const std::string &VAR_VALUE) const
bool IsPersistent() const
EXPORT int32_t processInbox(const std::string &SERVER_ID, const std::string &USER_ID, const std::string &ACCT_ID, const std::string &ACCT_LEDGER) const
static EXPORT bool CreateNewKey(OTString &strOutput, const OTString *pstrDisplay=nullptr, const OTPassword *pAlreadyHavePW=nullptr)
EXPORT std::string Ledger_GetTransactionByIndex(const std::string &SERVER_ID, const std::string &USER_ID, const std::string &ACCOUNT_ID, const std::string &THE_LEDGER, const int32_t &nIndex) const
EXPORT int32_t Smart_GetBylawCount(const std::string &THE_CONTRACT) const
virtual EXPORT void Release()
EXPORT std::string GetSentMessage(const int64_t &REQUEST_NUMBER, const std::string &SERVER_ID, const std::string &USER_ID) const
EXPORT std::string GetAccountWallet_AssetTypeID(const std::string &ACCOUNT_ID) const
EXPORT int32_t getContract(const OTIdentifier &SERVER_ID, const OTIdentifier &USER_ID, const OTIdentifier &ASSET_ID) const
EXPORT int32_t GetAssetTypeCount() const
EXPORT int32_t Smart_GetPartyCount(const std::string &THE_CONTRACT) const
EXPORT const std::string GetSubcredentialIDByIndex(size_t nIndex) const
EXPORT std::string PeekMemlogBack() const
EXPORT std::string GetNym_OutpaymentsRecipientIDByIndex(const std::string &NYM_ID, const int32_t &nIndex) const
EXPORT std::string GenerateBasketCreation(const std::string &USER_ID, const int64_t &MINIMUM_TRANSFER) const
EXPORT bool Nym_VerifyMailByIndex(const std::string &NYM_ID, const int32_t &nIndex) const
EXPORT std::string Wallet_ImportCert(const std::string &DISPLAY_NAME, const std::string &FILE_CONTENTS) const
Returns the imported cert's NymID, if successful. Else nullptr.
static EXPORT OTCronItem * NewCronItem(const OTString &strCronItem)
EXPORT OTMessage * GetMailByIndex(int32_t nIndex) const
EXPORT time64_t Token_GetValidFrom(const std::string &SERVER_ID, const std::string &ASSET_TYPE_ID, const std::string &THE_TOKEN) const
the date is seconds since Jan 1970.
EXPORT void AddItem(OTItem &theItem)
EXPORT std::string GetNym_SubCredentialContents(const std::string &NYM_ID, const std::string &MASTER_CRED_ID, const std::string &SUB_CRED_ID) const
EXPORT bool SaveSignedNymfile(OTPseudonym &SIGNER_NYM)
EXPORT int32_t queryAssetTypes(const std::string &SERVER_ID, const std::string &USER_ID, const std::string &ENCODED_MAP) const
EXPORT int32_t getTransactionNumber(const OTIdentifier &SERVER_ID, const OTIdentifier &USER_ID) const
EXPORT int32_t sendUserMessage(const OTIdentifier &SERVER_ID, const OTIdentifier &USER_ID, const OTIdentifier &USER_ID_RECIPIENT, const OTString &RECIPIENT_PUBKEY, const OTString &THE_MESSAGE) const
EXPORT bool IsBasketCurrency(const std::string &ASSET_TYPE_ID) const
EXPORT bool RemoveServerContract(const OTIdentifier &theTargetID)
EXPORT std::string GetNym_OutpaymentsContentsByIndex(const std::string &NYM_ID, const int32_t &nIndex) const
EXPORT std::string UlongToString(const uint64_t &lNumber) const
EXPORT int64_t Transaction_GetAmount(const std::string &SERVER_ID, const std::string &USER_ID, const std::string &ACCOUNT_ID, const std::string &THE_TRANSACTION) const
EXPORT std::string Party_GetID(const std::string &THE_CONTRACT, const std::string &PARTY_NAME) const
EXPORT std::string Encrypt(const std::string &RECIPIENT_NYM_ID, const std::string &strPlaintext) const
EXPORT OTTransaction * GetTransaction(OTTransaction::transactionType theType)
static EXPORT OTString PeekMemlogFront()
EXPORT int32_t exchangePurse(const std::string &SERVER_ID, const std::string &ASSET_TYPE_ID, const std::string &USER_ID, const std::string &THE_PURSE) const
EXPORT int32_t issueAssetType(const OTIdentifier &SERVER_ID, const OTIdentifier &USER_ID, const OTString &THE_CONTRACT) const
static bool bCleanupOTApp
EXPORT bool GetRecipientUserIDForDisplay(OTIdentifier &theReturnID)
EXPORT std::string Variable_GetContents(const std::string &THE_CONTRACT, const std::string &BYLAW_NAME, const std::string &VARIABLE_NAME) const
EXPORT std::string Smart_GetPartyByIndex(const std::string &THE_CONTRACT, const int32_t &nIndex) const
returns the name of the party.
EXPORT bool PopMemlogBack() const
EXPORT bool Wallet_ExportNym(const OTIdentifier &NYM_ID, OTString &strOutput) const
EXPORT void Output(const int32_t &nLogLevel, const std::string &strOutput) const
EXPORT bool VerifyUserPrivateKey(const std::string &USER_ID) const
EXPORT int32_t getAccount(const OTIdentifier &SERVER_ID, const OTIdentifier &USER_ID, const OTIdentifier &ACCT_ID) const
EXPORT std::string Transaction_GetVoucher(const std::string &SERVER_ID, const std::string &USER_ID, const std::string &ACCOUNT_ID, const std::string &THE_TRANSACTION) const
const OTIdentifier & GetServerID() const
EXPORT std::string Wallet_GetAccountIDFromPartial(const std::string &PARTIAL_ID) const