Open-Transactions
0.93.0-ge03d287
|
#include <Transactor.hpp>
Public Member Functions | |
Transactor (OTServer *server) | |
~Transactor () | |
bool | issueNextTransactionNumber (OTPseudonym &nym, int64_t &txNumber, bool storeNumber=true) |
bool | verifyTransactionNumber (OTPseudonym &nym, const int64_t &transactionNumber) |
bool | removeTransactionNumber (OTPseudonym &nym, const int64_t &transactionNumber, bool save=false) |
bool | removeIssuedNumber (OTPseudonym &nym, const int64_t &transactionNumber, bool save=false) |
int64_t | transactionNumber () const |
void | transactionNumber (int64_t value) |
bool | addAssetContract (OTAssetContract &contract) |
OTAssetContract * | getAssetContract (const OTIdentifier &id) |
bool | addBasketAccountID (const OTIdentifier &basketId, const OTIdentifier &basketAccountId, const OTIdentifier &basketContractId) |
bool | lookupBasketAccountID (const OTIdentifier &basketId, OTIdentifier &basketAccountId) |
bool | lookupBasketAccountIDByContractID (const OTIdentifier &basketContractId, OTIdentifier &basketAccountId) |
bool | lookupBasketContractIDByAccountID (const OTIdentifier &basketAccountId, OTIdentifier &basketContractId) |
std::shared_ptr< OTAccount > | getVoucherAccount (const OTIdentifier &assetTypeId) |
Mint * | getMint (const OTIdentifier &assetTypeId, int32_t seriesCount) |
Lookup the current mint for any given asset type ID and series. More... | |
Friends | |
class | MainFile |
Definition at line 153 of file Transactor.hpp.
|
explicit |
Definition at line 148 of file Transactor.cpp.
opentxs::Transactor::~Transactor | ( | ) |
Definition at line 154 of file Transactor.cpp.
bool opentxs::Transactor::addAssetContract | ( | OTAssetContract & | theContract | ) |
OTServer will take ownership of theContract from this point on, and will be responsible for deleting it. MUST be allocated on the heap.
Definition at line 411 of file Transactor.cpp.
bool opentxs::Transactor::addBasketAccountID | ( | const OTIdentifier & | basketId, |
const OTIdentifier & | basketAccountId, | ||
const OTIdentifier & | basketContractId | ||
) |
Definition at line 432 of file Transactor.cpp.
OTAssetContract * opentxs::Transactor::getAssetContract | ( | const OTIdentifier & | ASSET_TYPE_ID | ) |
The server supports various different asset types. Any user may create a new asset type by uploading the asset contract to the server. The server stores the contract in a directory and in its in-memory list of asset types. You can call this function to look up any asset contract by ID. If it returns nullptr, you can add it yourself by uploading the contract. But be sure that the public key in the contract, used to sign the contract, is also the public key of the Nym of the issuer. They must match. In the future I may create a special key category just for this purpose. Right now I'm using the "contract" key which is already used to verify any asset or server contract.
Definition at line 394 of file Transactor.cpp.
Mint * opentxs::Transactor::getMint | ( | const OTIdentifier & | assetTypeId, |
int32_t | seriesCount | ||
) |
Lookup the current mint for any given asset type ID and series.
Definition at line 565 of file Transactor.cpp.
std::shared_ptr< OTAccount > opentxs::Transactor::getVoucherAccount | ( | const OTIdentifier & | ASSET_TYPE_ID | ) |
Looked up the voucher account (where cashier's cheques are issued for any given asset type) return a pointer to the account. Since it's SUPPOSED to exist, and since it's being requested, also will GENERATE it if it cannot be found, add it to the list, and return the pointer. Should always succeed.
Definition at line 536 of file Transactor.cpp.
bool opentxs::Transactor::issueNextTransactionNumber | ( | OTPseudonym & | theNym, |
int64_t & | lTransactionNumber, | ||
bool | bStoreTheNumber = true |
||
) |
Just as every request must be accompanied by a request number, so every transaction request must be accompanied by a transaction number. The request numbers can simply be incremented on both sides (per user.) But the transaction numbers must be issued by the server and they do not repeat from user to user. They are unique to transaction.
Users must ask the server to send them transaction numbers so that they can be used in transaction requests. The server keeps an internal counter and maintains a data file to store the latest one.
More specifically, the server file itself stores the latest transaction number (So it knows what number to issue and increment when the next request comes in.)
But once it issues the next number, that number needs to be recorded in the nym file for the user it was issued to, so that it can be verified later when he submits it for a transaction–and so it can be removed once the transaction is complete (so it won't work twice.)
The option to bSaveTheNumber defaults to true for this reason. But sometimes it will be sent to false, in cases where the number doesn't need to be saved because it's never going to be verified. For example, if the server creates a transaction number so it can put a transaction into your inbox, it's never going to have to verify that it actually put it into the inbox by checking it's own nymfile for that transaction number. Instead it would just check its own server signature on the inbox. But I digress...
Definition at line 211 of file Transactor.cpp.
bool opentxs::Transactor::lookupBasketAccountID | ( | const OTIdentifier & | BASKET_ID, |
OTIdentifier & | BASKET_ACCOUNT_ID | ||
) |
Use this to find the basket account for this server (which is unique to this server) using the basket ID to look it up (the Basket ID is the same for all servers)
Definition at line 511 of file Transactor.cpp.
bool opentxs::Transactor::lookupBasketAccountIDByContractID | ( | const OTIdentifier & | BASKET_CONTRACT_ID, |
OTIdentifier & | BASKET_ACCOUNT_ID | ||
) |
Use this to find the basket account ID for this server (which is unique to this server) using the contract ID to look it up. (The basket contract ID is unique to this server.)
Definition at line 457 of file Transactor.cpp.
bool opentxs::Transactor::lookupBasketContractIDByAccountID | ( | const OTIdentifier & | BASKET_ACCOUNT_ID, |
OTIdentifier & | BASKET_CONTRACT_ID | ||
) |
Use this to find the basket account ID for this server (which is unique to this server) using the contract ID to look it up. (The basket contract ID is unique to this server.)
Definition at line 484 of file Transactor.cpp.
bool opentxs::Transactor::removeIssuedNumber | ( | OTPseudonym & | theNym, |
const int64_t & | lTransactionNumber, | ||
bool | bSave = false |
||
) |
Remove an issued number from the Nym record once that nym accepts the receipt from his inbox.
Definition at line 354 of file Transactor.cpp.
bool opentxs::Transactor::removeTransactionNumber | ( | OTPseudonym & | theNym, |
const int64_t & | lTransactionNumber, | ||
bool | bSave = false |
||
) |
Remove a transaction number from the Nym record once it's officially used/spent.
Definition at line 320 of file Transactor.cpp.
|
inline |
Definition at line 171 of file Transactor.hpp.
|
inline |
Definition at line 176 of file Transactor.hpp.
bool opentxs::Transactor::verifyTransactionNumber | ( | OTPseudonym & | theNym, |
const int64_t & | lTransactionNumber | ||
) |
Transaction numbers are now stored in the nym file (on client and server side) for whichever nym they were issued to. This function verifies whether or not the transaction number is present and valid for any specific nym (i.e. for the nym passed in.)
Definition at line 278 of file Transactor.cpp.
|
friend |
Definition at line 155 of file Transactor.hpp.