Master Core  v0.0.9 - 2abfd2849db8ba7a83957c64eb976b406713c123
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Functions
mastercore_rpc.cpp File Reference
#include "rpcserver.h"
#include "util.h"
#include "init.h"
#include "wallet.h"
#include "clientversion.h"
#include <stdint.h>
#include <string.h>
#include <map>
#include <fstream>
#include <vector>
#include <string>
#include <boost/algorithm/string.hpp>
#include <boost/algorithm/string/find.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/format.hpp>
#include "json/json_spirit_utils.h"
#include "json/json_spirit_value.h"
#include "leveldb/db.h"
#include "leveldb/write_batch.h"
#include <openssl/sha.h>
#include "mastercore.h"
#include "mastercore_convert.h"
#include "mastercore_dex.h"
#include "mastercore_parse_string.h"
#include "mastercore_tx.h"
#include "mastercore_sp.h"
#include "mastercore_rpc.h"
#include "mastercore_errors.h"
#include "mastercore_version.h"
+ Include dependency graph for mastercore_rpc.cpp:

Go to the source code of this file.

Functions

void PropertyToJSON (const CMPSPInfo::Entry &sProperty, Object &property_obj)
 
void MetaDexObjectToJSON (const CMPMetaDEx &obj, Object &metadex_obj)
 
void MetaDexObjectsToJSON (std::vector< CMPMetaDEx > &vMetaDexObjs, Array &response)
 
void BalanceToJSON (const std::string &address, uint32_t property, Object &balance_obj)
 
Value mscrpc (const Array &params, bool fHelp)
 
Value getbalance_MP (const Array &params, bool fHelp)
 
Value send_MP (const Array &params, bool fHelp)
 
Value sendtoowners_MP (const Array &params, bool fHelp)
 
Value sendrawtx_MP (const Array &params, bool fHelp)
 
Value getallbalancesforid_MP (const Array &params, bool fHelp)
 
Value getallbalancesforaddress_MP (const Array &params, bool fHelp)
 
Value getproperty_MP (const Array &params, bool fHelp)
 
Value listproperties_MP (const Array &params, bool fHelp)
 
Value getcrowdsale_MP (const Array &params, bool fHelp)
 
Value getactivecrowdsales_MP (const Array &params, bool fHelp)
 
Value getgrants_MP (const Array &params, bool fHelp)
 
int check_prop_valid (int64_t tmpPropId, string error, string exist_error)
 
Value getactivedexsells_MP (const Array &params, bool fHelp)
 
Value listblocktransactions_MP (const Array &params, bool fHelp)
 
int populateRPCTransactionObject (uint256 txid, Object *txobj, string filterAddress="")
 
Value gettransaction_MP (const Array &params, bool fHelp)
 
Value listtransactions_MP (const Array &params, bool fHelp)
 
Value getinfo_MP (const Array &params, bool fHelp)
 
Value getsto_MP (const Array &params, bool fHelp)
 
Value gettrade_MP (const Array &params, bool fHelp)
 

Function Documentation

void BalanceToJSON ( const std::string &  address,
uint32_t  property,
Object &  balance_obj 
)

Definition at line 99 of file mastercore_rpc.cpp.

References ACCEPT_RESERVE, FormatMP(), getMPbalance(), getUserAvailableMPbalance(), METADEX_RESERVE, and SELLOFFER_RESERVE.

Referenced by getallbalancesforaddress_MP(), getallbalancesforid_MP(), and getbalance_MP().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int check_prop_valid ( int64_t  tmpPropId,
string  error,
string  exist_error 
)

Definition at line 925 of file mastercore_rpc.cpp.

References mastercore::_my_sps, CMPSPInfo::getSP(), JSONRPCError(), and RPC_INVALID_PARAMETER.

+ Here is the call graph for this function:

Value getactivecrowdsales_MP ( const Array &  params,
bool  fHelp 
)
Value getactivedexsells_MP ( const Array &  params,
bool  fHelp 
)
Value getallbalancesforaddress_MP ( const Array &  params,
bool  fHelp 
)

Definition at line 462 of file mastercore_rpc.cpp.

References BalanceToJSON(), mastercore::getTally(), HelpExampleCli(), HelpExampleRpc(), CMPTally::init(), JSONRPCError(), CMPTally::next(), and RPC_INVALID_PARAMETER.

+ Here is the call graph for this function:

Value getallbalancesforid_MP ( const Array &  params,
bool  fHelp 
)

Definition at line 408 of file mastercore_rpc.cpp.

References mastercore::_my_sps, BalanceToJSON(), CMPSPInfo::getSP(), HelpExampleCli(), HelpExampleRpc(), JSONRPCError(), mastercore::mp_tally_map, and RPC_INVALID_PARAMETER.

+ Here is the call graph for this function:

Value getbalance_MP ( const Array &  params,
bool  fHelp 
)

Definition at line 221 of file mastercore_rpc.cpp.

References mastercore::_my_sps, BalanceToJSON(), CMPSPInfo::getSP(), JSONRPCError(), and RPC_INVALID_PARAMETER.

+ Here is the call graph for this function:

Value getcrowdsale_MP ( const Array &  params,
bool  fHelp 
)
Value getgrants_MP ( const Array &  params,
bool  fHelp 
)
Value getinfo_MP ( const Array &  params,
bool  fHelp 
)
Value getproperty_MP ( const Array &  params,
bool  fHelp 
)

Definition at line 510 of file mastercore_rpc.cpp.

References mastercore::_my_sps, CMPSPInfo::Entry::fixed, FormatMP(), base_uint< BITS >::GetHex(), CMPSPInfo::getSP(), mastercore::getTotalTokens(), HelpExampleCli(), HelpExampleRpc(), CMPSPInfo::Entry::issuer, JSONRPCError(), PropertyToJSON(), RPC_INVALID_PARAMETER, and CMPSPInfo::Entry::txid.

+ Here is the call graph for this function:

Value getsto_MP ( const Array &  params,
bool  fHelp 
)
Value gettrade_MP ( const Array &  params,
bool  fHelp 
)
Value gettransaction_MP ( const Array &  params,
bool  fHelp 
)

Definition at line 1698 of file mastercore_rpc.cpp.

References HelpExampleCli(), HelpExampleRpc(), JSONRPCError(), MP_BLOCK_NOT_IN_CHAIN, MP_CROWDSALE_WITHOUT_PROPERTY, MP_INVALID_TX_IN_DB_FOUND, MP_TX_IS_NOT_MASTER_PROTOCOL, MP_TX_NOT_FOUND, MP_TX_UNCONFIRMED, populateRPCTransactionObject(), RPC_INTERNAL_ERROR, RPC_INVALID_ADDRESS_OR_KEY, and base_uint< BITS >::SetHex().

+ Here is the call graph for this function:

Value listblocktransactions_MP ( const Array &  params,
bool  fHelp 
)

Definition at line 1305 of file mastercore_rpc.cpp.

References chainActive, CMPTxList::exists(), CTransaction::GetHash(), mastercore::GetHeight(), base_uint< BITS >::GetHex(), HelpExampleCli(), HelpExampleRpc(), JSONRPCError(), mastercore::p_txlistdb, ReadBlockFromDisk(), RPC_INTERNAL_ERROR, RPC_INVALID_PARAMETER, and CBlock::vtx.

+ Here is the call graph for this function:

Value listproperties_MP ( const Array &  params,
bool  fHelp 
)

Definition at line 561 of file mastercore_rpc.cpp.

References mastercore::_my_sps, CMPSPInfo::getSP(), HelpExampleCli(), HelpExampleRpc(), CMPSPInfo::peekNextSPID(), PropertyToJSON(), and TEST_ECO_PROPERTY_1.

+ Here is the call graph for this function:

Value listtransactions_MP ( const Array &  params,
bool  fHelp 
)
void MetaDexObjectsToJSON ( std::vector< CMPMetaDEx > &  vMetaDexObjs,
Array &  response 
)

Definition at line 84 of file mastercore_rpc.cpp.

References MetaDexObjectToJSON().

+ Here is the call graph for this function:

void MetaDexObjectToJSON ( const CMPMetaDEx obj,
Object &  metadex_obj 
)

Definition at line 57 of file mastercore_rpc.cpp.

References mastercore::_my_sps, FormatMP(), CMPMetaDEx::getAction(), CMPMetaDEx::getAddr(), CMPMetaDEx::getAmountDesired(), CMPMetaDEx::getAmountForSale(), CMPMetaDEx::getBlock(), CMPMetaDEx::getBlockTime(), CMPMetaDEx::getDesProperty(), CMPMetaDEx::getHash(), base_uint< BITS >::GetHex(), CMPMetaDEx::getProperty(), CMPSPInfo::getSP(), CMPSPInfo::Entry::isDivisible(), and mastercore::isTestEcosystemProperty().

Referenced by MetaDexObjectsToJSON().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Value mscrpc ( const Array &  params,
bool  fHelp 
)
int populateRPCTransactionObject ( uint256  txid,
Object *  txobj,
string  filterAddress = "" 
)

Definition at line 1356 of file mastercore_rpc.cpp.

References mastercore::_my_sps, CMPTxList::exists(), CMPSPInfo::findSPByTX(), FormatDivisibleMP(), FormatMP(), CMPMetaDEx::getAction(), CMPTransaction::getAmount(), CMPMetaDEx::getAmountDesired(), CMPOffer::getBlockTimeLimit(), CMPOffer::getBTCDesiredOriginal(), CMPMetaDEx::getDesProperty(), CMPTransaction::getFeePaid(), mastercore::GetHeight(), base_uint< BITS >::GetHex(), CMPOffer::getMinFee(), CMPTxList::getNumberOfPurchases(), CMPTransaction::getProperty(), CMPTxList::getPurchaseDetails(), CMPTransaction::getReceiver(), CMPTransaction::getSender(), CMPSPInfo::getSP(), CMPTransaction::getSPName(), CMPOffer::getSubaction(), mastercore::getTotalTokens(), GetTransaction(), CMPTransaction::getType(), CMPTransaction::getTypeString(), mastercore::getValidMPTX(), CMPTransaction::getVersion(), CMPTransaction::interpretPacket(), mastercore::isCrowdsalePurchase(), CMPSPInfo::Entry::isDivisible(), IsMyAddress(), mastercore::isPropertyDivisible(), mapBlockIndex, MP_BLOCK_NOT_IN_CHAIN, MP_CROWDSALE_WITHOUT_PROPERTY, MP_INVALID_TX_IN_DB_FOUND, MP_TX_IS_NOT_MASTER_PROTOCOL, MP_TX_NOT_FOUND, MP_TX_UNCONFIRMED, MSC_TYPE_ACCEPT_OFFER_BTC, MSC_TYPE_CLOSE_CROWDSALE, MSC_TYPE_CREATE_PROPERTY_FIXED, MSC_TYPE_CREATE_PROPERTY_MANUAL, MSC_TYPE_CREATE_PROPERTY_VARIABLE, MSC_TYPE_GRANT_PROPERTY_TOKENS, MSC_TYPE_METADEX, MSC_TYPE_REVOKE_PROPERTY_TOKENS, MSC_TYPE_SEND_TO_OWNERS, MSC_TYPE_SIMPLE_SEND, MSC_TYPE_TRADE_OFFER, CMPSPInfo::Entry::name, CBlockIndex::nHeight, mastercore::p_txlistdb, parseTransaction(), CMPTransaction::SetNull(), CMPTransaction::step1(), CMPTransaction::step2_SmartProperty(), CMPTransaction::step2_Value(), ValueFromAmount(), and CTransaction::vout.

Referenced by getsto_MP(), gettrade_MP(), gettransaction_MP(), and listtransactions_MP().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void PropertyToJSON ( const CMPSPInfo::Entry sProperty,
Object &  property_obj 
)

Definition at line 47 of file mastercore_rpc.cpp.

References CMPSPInfo::Entry::category, CMPSPInfo::Entry::data, CMPSPInfo::Entry::isDivisible(), CMPSPInfo::Entry::name, CMPSPInfo::Entry::subcategory, and CMPSPInfo::Entry::url.

Referenced by getproperty_MP(), and listproperties_MP().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Value send_MP ( const Array &  params,
bool  fHelp 
)

Definition at line 250 of file mastercore_rpc.cpp.

References mastercore::_my_sps, COIN, error_str(), base_uint< BITS >::GetHex(), CMPSPInfo::getSP(), CMPSPInfo::Entry::isDivisible(), JSONRPCError(), MSC_TYPE_SIMPLE_SEND, RPC_INVALID_PARAMETER, RPC_TYPE_ERROR, mastercore::send_INTERNAL_1packet(), and mastercore::StrToInt64().

+ Here is the call graph for this function:

Value sendrawtx_MP ( const Array &  params,
bool  fHelp 
)

Definition at line 367 of file mastercore_rpc.cpp.

References mastercore::ClassB_send(), Checkpoints::data, base_uint< BITS >::GetHex(), JSONRPCError(), ParseHex(), RPC_INVALID_PARAMETER, strprintf, and mastercore::StrToInt64().

+ Here is the call graph for this function:

Value sendtoowners_MP ( const Array &  params,
bool  fHelp 
)

Definition at line 312 of file mastercore_rpc.cpp.

References mastercore::_my_sps, error_str(), base_uint< BITS >::GetHex(), CMPSPInfo::getSP(), CMPSPInfo::Entry::isDivisible(), JSONRPCError(), MSC_TYPE_SEND_TO_OWNERS, RPC_INVALID_PARAMETER, RPC_TYPE_ERROR, mastercore::send_INTERNAL_1packet(), and mastercore::StrToInt64().

+ Here is the call graph for this function: