diff --git a/src/RPCHandler.cpp b/src/RPCHandler.cpp index 96a1c7ec97..37bdd4dc04 100644 --- a/src/RPCHandler.cpp +++ b/src/RPCHandler.cpp @@ -326,125 +326,7 @@ Json::Value RPCHandler::doAcceptLedger(const Json::Value ¶ms) return obj; } -// account_domain_set [] -Json::Value RPCHandler::doAccountDomainSet(const Json::Value ¶ms) -{ - RippleAddress naSrcAccountID; - RippleAddress naSeed; - if (!naSeed.setSeedGeneric(params[0u].asString())) - { - return rpcError(rpcBAD_SEED); - } - else if (!naSrcAccountID.setAccountID(params[1u].asString())) - { - return rpcError(rpcSRC_ACT_MALFORMED); - } - - RippleAddress naVerifyGenerator; - RippleAddress naAccountPublic; - RippleAddress naAccountPrivate; - AccountState::pointer asSrc; - STAmount saSrcBalance; - Json::Value obj = authorize(uint256(0), naSeed, naSrcAccountID, naAccountPublic, naAccountPrivate, - saSrcBalance, theConfig.FEE_DEFAULT, asSrc, naVerifyGenerator); - - if (!obj.empty()) - return obj; - - Transaction::pointer trans = Transaction::sharedAccountSet( - naAccountPublic, naAccountPrivate, - naSrcAccountID, - asSrc->getSeq(), - theConfig.FEE_DEFAULT, - 0, // YYY No source tag - false, - uint128(), - false, - 0, - 0, - RippleAddress(), - true, - strCopy(params[2u].asString()), - false, - 0); - - trans = mNetOps->submitTransaction(trans); - - obj["transaction"] = trans->getSTransaction()->getJson(0); - obj["status"] = trans->getStatus(); - - return Json::Value(Json::objectValue); -} - -// account_email_set [] -Json::Value RPCHandler::doAccountEmailSet(const Json::Value ¶ms) -{ - RippleAddress naSrcAccountID; - RippleAddress naSeed; - - if (!naSeed.setSeedGeneric(params[0u].asString())) - { - return rpcError(rpcBAD_SEED); - } - else if (!naSrcAccountID.setAccountID(params[1u].asString())) - { - return rpcError(rpcSRC_ACT_MALFORMED); - } - - RippleAddress naVerifyGenerator; - RippleAddress naAccountPublic; - RippleAddress naAccountPrivate; - AccountState::pointer asSrc; - STAmount saSrcBalance; - Json::Value obj = authorize(uint256(0), naSeed, naSrcAccountID, naAccountPublic, naAccountPrivate, - saSrcBalance, theConfig.FEE_DEFAULT, asSrc, naVerifyGenerator); - - if (!obj.empty()) - return obj; - - // Hash as per: http://en.gravatar.com/site/implement/hash/ - std::string strEmail = 3 == params.size() ? params[2u].asString() : ""; - boost::trim(strEmail); - boost::to_lower(strEmail); - - std::vector vucMD5(128/8, 0); - MD5(reinterpret_cast(strEmail.data()), strEmail.size(), &vucMD5.front()); - - uint128 uEmailHash(vucMD5); - std::vector vucDomain; - - Transaction::pointer trans = Transaction::sharedAccountSet( - naAccountPublic, naAccountPrivate, - naSrcAccountID, - asSrc->getSeq(), - theConfig.FEE_DEFAULT, - 0, // YYY No source tag - true, - strEmail.empty() ? uint128() : uEmailHash, - false, - uint256(), - 0, - RippleAddress(), - false, - vucDomain, - false, - 0); - - trans = mNetOps->submitTransaction(trans); - - obj["transaction"] = trans->getSTransaction()->getJson(0); - obj["status"] = trans->getStatus(); - - if (!strEmail.empty()) - { - obj["Email"] = strEmail; - obj["EmailHash"] = strHex(vucMD5); - obj["UrlGravatar"] = AccountState::createGravatarUrl(uEmailHash); - } - - return obj; -} // account_info || // account_info || [] @@ -498,177 +380,6 @@ Json::Value RPCHandler::doAccountInfo(const Json::Value ¶ms) -// account_message_set -Json::Value RPCHandler::doAccountMessageSet(const Json::Value& params) { - RippleAddress naSrcAccountID; - RippleAddress naSeed; - RippleAddress naMessagePubKey; - - if (!naSeed.setSeedGeneric(params[0u].asString())) - { - return rpcError(rpcBAD_SEED); - } - else if (!naSrcAccountID.setAccountID(params[1u].asString())) - { - return rpcError(rpcSRC_ACT_MALFORMED); - } - else if (!naMessagePubKey.setAccountPublic(params[2u].asString())) - { - return rpcError(rpcPUBLIC_MALFORMED); - } - - RippleAddress naVerifyGenerator; - RippleAddress naAccountPublic; - RippleAddress naAccountPrivate; - AccountState::pointer asSrc; - STAmount saSrcBalance; - Json::Value obj = authorize(uint256(0), naSeed, naSrcAccountID, naAccountPublic, naAccountPrivate, - saSrcBalance, theConfig.FEE_DEFAULT, asSrc, naVerifyGenerator); - std::vector vucDomain; - - if (!obj.empty()) - return obj; - - Transaction::pointer trans = Transaction::sharedAccountSet( - naAccountPublic, naAccountPrivate, - naSrcAccountID, - asSrc->getSeq(), - theConfig.FEE_DEFAULT, - 0, // YYY No source tag - false, - uint128(), - false, - uint256(), - 0, - naMessagePubKey, - false, - vucDomain, - false, - 0); - - trans = mNetOps->submitTransaction(trans); - - obj["transaction"] = trans->getSTransaction()->getJson(0); - obj["status"] = trans->getStatus(); - obj["MessageKey"] = naMessagePubKey.humanAccountPublic(); - - return obj; -} - -// account_rate_set -Json::Value RPCHandler::doAccountRateSet(const Json::Value ¶ms) -{ - RippleAddress naSrcAccountID; - RippleAddress naSeed; - - if (!naSeed.setSeedGeneric(params[0u].asString())) - { - return rpcError(rpcBAD_SEED); - } - else if (!naSrcAccountID.setAccountID(params[1u].asString())) - { - return rpcError(rpcSRC_ACT_MALFORMED); - } - - RippleAddress naVerifyGenerator; - RippleAddress naAccountPublic; - RippleAddress naAccountPrivate; - AccountState::pointer asSrc; - STAmount saSrcBalance; - Json::Value obj = authorize(uint256(0), naSeed, naSrcAccountID, naAccountPublic, naAccountPrivate, - saSrcBalance, theConfig.FEE_DEFAULT, asSrc, naVerifyGenerator); - - if (!obj.empty()) - return obj; - - uint32 uRate = lexical_cast_s(params[2u].asString()); - std::vector vucDomain; - - Transaction::pointer trans = Transaction::sharedAccountSet( - naAccountPublic, naAccountPrivate, - naSrcAccountID, - asSrc->getSeq(), - theConfig.FEE_DEFAULT, - 0, // YYY No source tag - false, - uint128(), - false, - 0, - 0, - RippleAddress(), - false, - vucDomain, - true, - uRate); - - trans = mNetOps->submitTransaction(trans); - - obj["transaction"] = trans->getSTransaction()->getJson(0); - obj["status"] = trans->getStatus(); - - return Json::Value(Json::objectValue); -} - -// account_wallet_set [] -Json::Value RPCHandler::doAccountWalletSet(const Json::Value& params) { - RippleAddress naSrcAccountID; - RippleAddress naSeed; - - if (!naSeed.setSeedGeneric(params[0u].asString())) - { - return rpcError(rpcBAD_SEED); - } - else if (!naSrcAccountID.setAccountID(params[1u].asString())) - { - return rpcError(rpcSRC_ACT_MALFORMED); - } - - RippleAddress naMasterGenerator; - RippleAddress naAccountPublic; - RippleAddress naAccountPrivate; - AccountState::pointer asSrc; - STAmount saSrcBalance; - Json::Value obj = authorize(uint256(0), naSeed, naSrcAccountID, naAccountPublic, naAccountPrivate, - saSrcBalance, theConfig.FEE_DEFAULT, asSrc, naMasterGenerator); - std::vector vucDomain; - - if (!obj.empty()) - return obj; - - std::string strWalletLocator = params.size() == 3 ? params[2u].asString() : ""; - uint256 uWalletLocator; - uint32 uWalletSize = 0; // XXX Broken should be an argument. - - if (!strWalletLocator.empty()) - uWalletLocator.SetHex(strWalletLocator); - - Transaction::pointer trans = Transaction::sharedAccountSet( - naAccountPublic, naAccountPrivate, - naSrcAccountID, - asSrc->getSeq(), - theConfig.FEE_DEFAULT, - 0, // YYY No source tag - false, - uint128(), - true, - uWalletLocator, - uWalletSize, - RippleAddress(), - false, - vucDomain, - false, - 0); - - trans = mNetOps->submitTransaction(trans); - - obj["transaction"] = trans->getSTransaction()->getJson(0); - obj["status"] = trans->getStatus(); - - if (!strWalletLocator.empty()) - obj["WalletLocator"] = uWalletLocator.GetHex(); - - return obj; -} Json::Value RPCHandler::doConnect(const Json::Value& params) { @@ -782,192 +493,6 @@ Json::Value RPCHandler::doNicknameInfo(const Json::Value& params) return ret; } -// nickname_set [] [] -Json::Value RPCHandler::doNicknameSet(const Json::Value& params) -{ - RippleAddress naSrcAccountID; - RippleAddress naSeed; - - if (!naSeed.setSeedGeneric(params[0u].asString())) - { - return rpcError(rpcBAD_SEED); - } - else if (!naSrcAccountID.setAccountID(params[1u].asString())) - { - return rpcError(rpcSRC_ACT_MALFORMED); - } - - STAmount saMinimumOffer; - bool bSetOffer = params.size() >= 4; - std::string strOfferCurrency; - std::string strNickname = params[2u].asString(); - boost::trim(strNickname); - - if (strNickname.empty()) - { - return rpcError(rpcNICKNAME_MALFORMED); - } - else if (params.size() >= 4 && !saMinimumOffer.setFullValue(params[3u].asString(), strOfferCurrency)) - { - return rpcError(rpcDST_AMT_MALFORMED); - } - - STAmount saFee; - NicknameState::pointer nsSrc = mNetOps->getNicknameState(uint256(0), strNickname); - - if (!nsSrc) - { - // Creating nickname. - saFee = theConfig.FEE_NICKNAME_CREATE; - } - else if (naSrcAccountID != nsSrc->getAccountID()) - { - // We don't own the nickname. - return rpcError(rpcNICKNAME_PERM); - } - else - { - // Setting the minimum offer. - saFee = theConfig.FEE_DEFAULT; - } - - RippleAddress naMasterGenerator; - RippleAddress naAccountPublic; - RippleAddress naAccountPrivate; - AccountState::pointer asSrc; - STAmount saSrcBalance; - Json::Value obj = authorize(uint256(0), naSeed, naSrcAccountID, naAccountPublic, naAccountPrivate, - saSrcBalance, saFee, asSrc, naMasterGenerator); - - if (!obj.empty()) - return obj; - - // YYY Could verify nickname does not exist or points to paying account. - // XXX Adjust fee for nickname create. - - Transaction::pointer trans = Transaction::sharedNicknameSet( - naAccountPublic, naAccountPrivate, - naSrcAccountID, - asSrc->getSeq(), - saFee, - 0, // YYY No source tag - Ledger::getNicknameHash(strNickname), - bSetOffer, - saMinimumOffer); - - trans = mNetOps->submitTransaction(trans); - - obj["transaction"] = trans->getSTransaction()->getJson(0); - obj["status"] = trans->getStatus(); - - return obj; -} - -// offer_create [passive] -// *offering* for *wants* -Json::Value RPCHandler::doOfferCreate(const Json::Value ¶ms) -{ - RippleAddress naSeed; - RippleAddress naSrcAccountID; - STAmount saTakerPays; - STAmount saTakerGets; - - if (!naSeed.setSeedGeneric(params[0u].asString())) - { - return rpcError(rpcBAD_SEED); - } - else if (!naSrcAccountID.setAccountID(params[1u].asString())) - { - return rpcError(rpcSRC_ACT_MALFORMED); - } - else if (!saTakerGets.setFullValue(params[2u].asString(), params[3u].asString(), params[4u].asString())) - { - return rpcError(rpcGETS_AMT_MALFORMED); - } - else if (!saTakerPays.setFullValue(params[5u].asString(), params[6u].asString(), params[7u].asString())) - { - return rpcError(rpcPAYS_AMT_MALFORMED); - } - else if (params.size() == 10 && params[9u].asString() != "passive") - { - return rpcError(rpcINVALID_PARAMS); - } - - uint32 uExpiration = lexical_cast_s(params[8u].asString()); - bool bPassive = params.size() == 10; - - RippleAddress naMasterGenerator; - RippleAddress naAccountPublic; - RippleAddress naAccountPrivate; - AccountState::pointer asSrc; - STAmount saSrcBalance; - Json::Value obj = authorize(uint256(0), naSeed, naSrcAccountID, naAccountPublic, naAccountPrivate, - saSrcBalance, theConfig.FEE_DEFAULT, asSrc, naMasterGenerator); - - if (!obj.empty()) - return obj; - - Transaction::pointer trans = Transaction::sharedOfferCreate( - naAccountPublic, naAccountPrivate, - naSrcAccountID, - asSrc->getSeq(), - theConfig.FEE_DEFAULT, - 0, // YYY No source tag - bPassive, - saTakerPays, - saTakerGets, - uExpiration); - - trans = mNetOps->submitTransaction(trans); - - obj["transaction"] = trans->getSTransaction()->getJson(0); - obj["status"] = trans->getStatus(); - - return obj; -} - -// offer_cancel -Json::Value RPCHandler::doOfferCancel(const Json::Value ¶ms) -{ - RippleAddress naSeed; - RippleAddress naSrcAccountID; - uint32 uSequence = lexical_cast_s(params[2u].asString()); - - if (!naSeed.setSeedGeneric(params[0u].asString())) - { - return rpcError(rpcBAD_SEED); - } - else if (!naSrcAccountID.setAccountID(params[1u].asString())) - { - return rpcError(rpcSRC_ACT_MALFORMED); - } - - RippleAddress naMasterGenerator; - RippleAddress naAccountPublic; - RippleAddress naAccountPrivate; - AccountState::pointer asSrc; - STAmount saSrcBalance; - Json::Value obj = authorize(uint256(0), naSeed, naSrcAccountID, naAccountPublic, naAccountPrivate, - saSrcBalance, theConfig.FEE_DEFAULT, asSrc, naMasterGenerator); - - if (!obj.empty()) - return obj; - - Transaction::pointer trans = Transaction::sharedOfferCancel( - naAccountPublic, naAccountPrivate, - naSrcAccountID, - asSrc->getSeq(), - theConfig.FEE_DEFAULT, - 0, // YYY No source tag - uSequence); - - trans = mNetOps->submitTransaction(trans); - - obj["transaction"] = trans->getSTransaction()->getJson(0); - obj["status"] = trans->getStatus(); - - return obj; -} // owner_info || // owner_info || [] @@ -993,150 +518,7 @@ Json::Value RPCHandler::doOwnerInfo(const Json::Value& params) return ret; } -// password_fund [] -// YYY Make making account default to first account for seed. -Json::Value RPCHandler::doPasswordFund(const Json::Value ¶ms) -{ - RippleAddress naSrcAccountID; - RippleAddress naDstAccountID; - RippleAddress naSeed; - if (!naSeed.setSeedGeneric(params[0u].asString())) - { - return rpcError(rpcBAD_SEED); - } - else if (!naSrcAccountID.setAccountID(params[1u].asString())) - { - return rpcError(rpcSRC_ACT_MALFORMED); - } - else if (!naDstAccountID.setAccountID(params[params.size() == 3 ? 2u : 1u].asString())) - { - return rpcError(rpcDST_ACT_MALFORMED); - } - - RippleAddress naMasterGenerator; - RippleAddress naAccountPublic; - RippleAddress naAccountPrivate; - AccountState::pointer asSrc; - STAmount saSrcBalance; - Json::Value obj = authorize(uint256(0), naSeed, naSrcAccountID, naAccountPublic, naAccountPrivate, - saSrcBalance, theConfig.FEE_DEFAULT, asSrc, naMasterGenerator); - - if (!obj.empty()) - return obj; - - // YYY Could verify dst exists and isn't already funded. - - Transaction::pointer trans = Transaction::sharedPasswordFund( - naAccountPublic, naAccountPrivate, - naSrcAccountID, - asSrc->getSeq(), - theConfig.FEE_DEFAULT, - 0, // YYY No source tag - naDstAccountID); - - trans = mNetOps->submitTransaction(trans); - - obj["transaction"] = trans->getSTransaction()->getJson(0); - obj["status"] = trans->getStatus(); - - return obj; -} - -// password_set [] -Json::Value RPCHandler::doPasswordSet(const Json::Value& params) -{ - RippleAddress naMasterSeed; - RippleAddress naRegularSeed; - RippleAddress naAccountID; - - if (!naMasterSeed.setSeedGeneric(params[0u].asString())) - { - // Should also not allow account id's as seeds. - return rpcError(rpcBAD_SEED); - } - else if (!naRegularSeed.setSeedGeneric(params[1u].asString())) - { - // Should also not allow account id's as seeds. - return rpcError(rpcBAD_SEED); - } - // YYY Might use account from string to be more flexible. - else if (params.size() >= 3 && !naAccountID.setAccountID(params[2u].asString())) - { - return rpcError(rpcACT_MALFORMED); - } - else - { - RippleAddress naMasterGenerator = RippleAddress::createGeneratorPublic(naMasterSeed); - RippleAddress naRegularGenerator = RippleAddress::createGeneratorPublic(naRegularSeed); - RippleAddress naRegular0Public; - RippleAddress naRegular0Private; - - RippleAddress naAccountPublic; - RippleAddress naAccountPrivate; - - naAccountPublic.setAccountPublic(naMasterGenerator, 0); - naAccountPrivate.setAccountPrivate(naMasterGenerator, naMasterSeed, 0); - - naRegular0Public.setAccountPublic(naRegularGenerator, 0); - naRegular0Private.setAccountPrivate(naRegularGenerator, naRegularSeed, 0); - - // Hash of regular account #0 public key. - // uint160 uGeneratorID = naRegular0Public.getAccountID(); - std::vector vucGeneratorCipher = naRegular0Private.accountPrivateEncrypt(naRegular0Public, naMasterGenerator.getGenerator()); - std::vector vucGeneratorSig; - - // Prove that we have the corresponding private key to the generator id. So, we can get the generator id. - // XXX Check result. - naRegular0Private.accountPrivateSign(Serializer::getSHA512Half(vucGeneratorCipher), vucGeneratorSig); - - RippleAddress naMasterXPublic; - RippleAddress naRegularXPublic; - unsigned int iIndex = -1; // Compensate for initial increment. - int iMax = theConfig.ACCOUNT_PROBE_MAX; - - // YYY Could probe periodically to see if accounts exists. - // YYY Max could be set randomly. - // Don't look at ledger entries to determine if the account exists. Don't want to leak to thin server that these accounts are - // related. - do { - ++iIndex; - naMasterXPublic.setAccountPublic(naMasterGenerator, iIndex); - naRegularXPublic.setAccountPublic(naRegularGenerator, iIndex); - - std::cerr << iIndex << ": " << naRegularXPublic.humanAccountID() << std::endl; - - } while (naAccountID.getAccountID() != naMasterXPublic.getAccountID() && --iMax); - - if (!iMax) - { - return rpcError(rpcACT_NOT_FOUND); - } - - Transaction::pointer trans = Transaction::sharedPasswordSet( - naAccountPublic, naAccountPrivate, - 0, - naRegularXPublic, - vucGeneratorCipher, - naRegular0Public.getAccountPublic(), - vucGeneratorSig); - - trans = mNetOps->submitTransaction(trans); - - Json::Value obj(Json::objectValue); - - // We "echo" the seeds so they can be checked. - obj["master_seed"] = naMasterSeed.humanSeed(); - obj["master_key"] = naMasterSeed.humanSeed1751(); - obj["regular_seed"] = naRegularSeed.humanSeed(); - obj["regular_key"] = naRegularSeed.humanSeed1751(); - - obj["transaction"] = trans->getSTransaction()->getJson(0); - obj["status"] = trans->getStatus(); - - return obj; - } -} Json::Value RPCHandler::doPeers(const Json::Value& params) { @@ -1236,310 +618,6 @@ Json::Value RPCHandler::doProfile(const Json::Value ¶ms) return obj; } -// ripple -// [] -// + -// full|partial limit|average [] -// -// path: -// path + -// -// path_element: -// account [] [] -// offer [] -Json::Value RPCHandler::doRipple(const Json::Value ¶ms) -{ - RippleAddress naSeed; - STAmount saSrcAmountMax; - uint160 uSrcCurrencyID; - RippleAddress naSrcAccountID; - RippleAddress naSrcIssuerID; - bool bPartial; - bool bFull; - bool bLimit; - bool bAverage; - RippleAddress naDstAccountID; - STAmount saDstAmount; - uint160 uDstCurrencyID; - - STPathSet spsPaths; - - naSrcIssuerID.setAccountID(params[4u].asString()); // - - if (!naSeed.setSeedGeneric(params[0u].asString())) // - { - return rpcError(rpcBAD_SEED); - } - else if (!naSrcAccountID.setAccountID(params[1u].asString())) // - { - return rpcError(rpcSRC_ACT_MALFORMED); - } - // [] - else if (!saSrcAmountMax.setFullValue(params[2u].asString(), params[3u].asString(), params[naSrcIssuerID.isValid() ? 4u : 1u].asString())) - { - // Log(lsINFO) << "naSrcIssuerID.isValid(): " << naSrcIssuerID.isValid(); - // Log(lsINFO) << "source_max: " << params[2u].asString(); - // Log(lsINFO) << "source_currency: " << params[3u].asString(); - // Log(lsINFO) << "source_issuer: " << params[naSrcIssuerID.isValid() ? 4u : 2u].asString(); - - return rpcError(rpcSRC_AMT_MALFORMED); - } - - int iArg = 4 + naSrcIssuerID.isValid(); - - // XXX bSrcRedeem & bSrcIssue not used. - STPath spPath; - - while (params.size() != iArg && params[iArg].asString() == "path") // path - { - Log(lsINFO) << "Path>"; - ++iArg; - - while (params.size() != iArg - && (params[iArg].asString() == "offer" || params[iArg].asString() == "account")) - { - if (params.size() >= iArg + 3 && params[iArg].asString() == "offer") // offer - { - Log(lsINFO) << "Offer>"; - uint160 uCurrencyID; - RippleAddress naIssuerID; - - ++iArg; - - if (!STAmount::currencyFromString(uCurrencyID, params[iArg++].asString())) // - { - return rpcError(rpcINVALID_PARAMS); - } - else if (naIssuerID.setAccountID(params[iArg].asString())) // [] - { - ++iArg; - } - - spPath.addElement(STPathElement( - uint160(0), - uCurrencyID, - naIssuerID.isValid() ? naIssuerID.getAccountID() : uint160(0))); - } - else if (params.size() >= iArg + 2 && params[iArg].asString() == "account") // account - { - Log(lsINFO) << "Account>"; - RippleAddress naAccountID; - uint160 uCurrencyID; - RippleAddress naIssuerID; - - ++iArg; - - if (!naAccountID.setAccountID(params[iArg++].asString())) // - { - return rpcError(rpcINVALID_PARAMS); - } - - if (params.size() != iArg && STAmount::currencyFromString(uCurrencyID, params[iArg].asString())) // [] - { - ++iArg; - } - - if (params.size() != iArg && naIssuerID.setAccountID(params[iArg].asString())) // [] - { - ++iArg; - } - - spPath.addElement(STPathElement( - naAccountID.getAccountID(), - uCurrencyID, - naIssuerID.isValid() ? naIssuerID.getAccountID() : uint160(0))); - } - else - { - return rpcError(rpcINVALID_PARAMS); - } - } - - if (spPath.isEmpty()) - { - return rpcError(rpcINVALID_PARAMS); - } - else - { - spsPaths.addPath(spPath); - spPath.clear(); - } - } - - // full|partial - bPartial = params.size() != iArg ? params[iArg].asString() == "partial" : false; - bFull = params.size() != iArg ? params[iArg].asString() == "full" : false; - - if (!bPartial && !bFull) - { - return rpcError(rpcINVALID_PARAMS); - } - else - { - ++iArg; - } - - // limit|average - bLimit = params.size() != iArg ? params[iArg].asString() == "limit" : false; - bAverage = params.size() != iArg ? params[iArg].asString() == "average" : false; - - if (!bLimit && !bAverage) - { - return rpcError(rpcINVALID_PARAMS); - } - else - { - ++iArg; - } - - if (params.size() != iArg && !naDstAccountID.setAccountID(params[iArg++].asString())) // - { - return rpcError(rpcDST_ACT_MALFORMED); - } - - const unsigned int uDstIssuer = params.size() == iArg + 3 ? iArg+2 : iArg-1; - - // - if (params.size() != iArg + 2 && params.size() != iArg + 3) - { - // Log(lsINFO) << "params.size(): " << params.size(); - - return rpcError(rpcDST_AMT_MALFORMED); - } - else if (!saDstAmount.setFullValue(params[iArg].asString(), params[iArg+1].asString(), params[uDstIssuer].asString())) - { - // Log(lsINFO) << " Amount: " << params[iArg].asString(); - // Log(lsINFO) << "Currency: " << params[iArg+1].asString(); - // Log(lsINFO) << " Issuer: " << params[uDstIssuer].asString(); - - return rpcError(rpcDST_AMT_MALFORMED); - } - - AccountState::pointer asDst = mNetOps->getAccountState(uint256(0), naDstAccountID); - STAmount saFee = theConfig.FEE_DEFAULT; - - RippleAddress naVerifyGenerator; - RippleAddress naAccountPublic; - RippleAddress naAccountPrivate; - AccountState::pointer asSrc; - STAmount saSrcBalance; - Json::Value obj = authorize(uint256(0), naSeed, naSrcAccountID, naAccountPublic, naAccountPrivate, - saSrcBalance, saFee, asSrc, naVerifyGenerator); - - if (!obj.empty()) - return obj; - - // YYY Could do some checking: source has funds or credit, dst exists and has sufficent credit limit. - // YYY Currency from same source or loops not allowed. - // YYY Limit paths length and count. - if (!asDst) - { - Log(lsINFO) << "naDstAccountID: " << naDstAccountID.humanAccountID(); - - return rpcError(rpcDST_ACT_MISSING); - } - - Transaction::pointer trans = Transaction::sharedPayment( - naAccountPublic, naAccountPrivate, - naSrcAccountID, - asSrc->getSeq(), - saFee, - 0, // YYY No source tag - naDstAccountID, - saDstAmount, - saSrcAmountMax, - spsPaths, - bPartial, - bLimit); - - trans = mNetOps->submitTransaction(trans); - - obj["transaction"] = trans->getSTransaction()->getJson(0); - obj["status"] = trans->getStatus(); - obj["seed"] = naSeed.humanSeed(); - obj["fee"] = saFee.getText(); - obj["srcAccountID"] = naSrcAccountID.humanAccountID(); - obj["dstAccountID"] = naDstAccountID.humanAccountID(); - obj["srcAmountMax"] = saSrcAmountMax.getText(); - obj["srcISO"] = saSrcAmountMax.getHumanCurrency(); - obj["dstAmount"] = saDstAmount.getText(); - obj["dstISO"] = saDstAmount.getHumanCurrency(); - obj["paths"] = spsPaths.getText(); - - return obj; -} - -// ripple_line_set [] [] [] -Json::Value RPCHandler::doRippleLineSet(const Json::Value& params) -{ - RippleAddress naSeed; - RippleAddress naSrcAccountID; - RippleAddress naDstAccountID; - STAmount saLimitAmount; - bool bQualityIn = params.size() >= 6; - bool bQualityOut = params.size() >= 7; - uint32 uQualityIn = 0; - uint32 uQualityOut = 0; - - if (!naSeed.setSeedGeneric(params[0u].asString())) - { - return rpcError(rpcBAD_SEED); - } - else if (!naSrcAccountID.setAccountID(params[1u].asString())) - { - return rpcError(rpcSRC_ACT_MALFORMED); - } - else if (!naDstAccountID.setAccountID(params[2u].asString())) - { - return rpcError(rpcDST_ACT_MALFORMED); - } - else if (!saLimitAmount.setFullValue(params[3u].asString(), params.size() >= 5 ? params[4u].asString() : "", params[2u].asString())) - { - return rpcError(rpcSRC_AMT_MALFORMED); - } - else if (bQualityIn && !parseQuality(params[5u].asString(), uQualityIn)) - { - return rpcError(rpcQUALITY_MALFORMED); - } - else if (bQualityOut && !parseQuality(params[6u].asString(), uQualityOut)) - { - return rpcError(rpcQUALITY_MALFORMED); - } - else - { - RippleAddress naMasterGenerator; - RippleAddress naAccountPublic; - RippleAddress naAccountPrivate; - AccountState::pointer asSrc; - STAmount saSrcBalance; - Json::Value obj = authorize(uint256(0), naSeed, naSrcAccountID, naAccountPublic, naAccountPrivate, - saSrcBalance, theConfig.FEE_DEFAULT, asSrc, naMasterGenerator); - - if (!obj.empty()) - return obj; - - Transaction::pointer trans = Transaction::sharedCreditSet( - naAccountPublic, naAccountPrivate, - naSrcAccountID, - asSrc->getSeq(), - theConfig.FEE_DEFAULT, - 0, // YYY No source tag - saLimitAmount, - bQualityIn, uQualityIn, - bQualityOut, uQualityOut); - - trans = mNetOps->submitTransaction(trans); - - obj["transaction"] = trans->getSTransaction()->getJson(0); - obj["status"] = trans->getStatus(); - obj["seed"] = naSeed.humanSeed(); - obj["srcAccountID"] = naSrcAccountID.humanAccountID(); - obj["dstAccountID"] = naDstAccountID.humanAccountID(); - - return obj; - } -} - // ripple_lines_get || [] Json::Value RPCHandler::doRippleLinesGet(const Json::Value ¶ms) { @@ -1837,158 +915,6 @@ Json::Value RPCHandler::handleJSONSubmit(std::string& key, Json::Value& txJSON) } -// send regular_seed paying_account account_id amount [currency] [issuer] [send_max] [send_currency] [send_issuer] -Json::Value RPCHandler::doSend(const Json::Value& params) -{ - RippleAddress naSeed; - RippleAddress naSrcAccountID; - RippleAddress naDstAccountID; - STAmount saSrcAmountMax; - STAmount saDstAmount; - std::string sSrcCurrency; - std::string sDstCurrency; - std::string sSrcIssuer; - std::string sDstIssuer; - - if (params.size() >= 5) - sDstCurrency = params[4u].asString(); - - if (params.size() >= 6) - sDstIssuer = params[5u].asString(); - - if (params.size() >= 8) - sSrcCurrency = params[7u].asString(); - - if (params.size() >= 9) - sSrcIssuer = params[8u].asString(); - - if (!naSeed.setSeedGeneric(params[0u].asString())) - { - return rpcError(rpcBAD_SEED); - } - else if (!naSrcAccountID.setAccountID(params[1u].asString())) - { - return rpcError(rpcSRC_ACT_MALFORMED); - } - else if (!naDstAccountID.setAccountID(params[2u].asString())) - { - return rpcError(rpcDST_ACT_MALFORMED); - } - else if (!saDstAmount.setFullValue(params[3u].asString(), sDstCurrency, sDstIssuer)) - { - return rpcError(rpcDST_AMT_MALFORMED); - } - else if (params.size() >= 7 && !saSrcAmountMax.setFullValue(params[6u].asString(), sSrcCurrency, sSrcIssuer)) - { - return rpcError(rpcSRC_AMT_MALFORMED); - } - else - { - AccountState::pointer asDst = mNetOps->getAccountState(uint256(0), naDstAccountID); - bool bCreate = !asDst; - STAmount saFee = bCreate ? theConfig.FEE_ACCOUNT_CREATE : theConfig.FEE_DEFAULT; - - RippleAddress naVerifyGenerator; - RippleAddress naAccountPublic; - RippleAddress naAccountPrivate; - AccountState::pointer asSrc; - STAmount saSrcBalance; - Json::Value obj = authorize(uint256(0), naSeed, naSrcAccountID, naAccountPublic, naAccountPrivate, - saSrcBalance, saFee, asSrc, naVerifyGenerator); - - // Log(lsINFO) << boost::str(boost::format("doSend: sSrcIssuer=%s sDstIssuer=%s saSrcAmountMax=%s saDstAmount=%s") - // % sSrcIssuer - // % sDstIssuer - // % saSrcAmountMax.getFullText() - // % saDstAmount.getFullText()); - - if (!obj.empty()) - return obj; - - if (params.size() < 7) - saSrcAmountMax = saDstAmount; - - // Do a few simple checks. - if (!saSrcAmountMax.isNative()) - { - Log(lsINFO) << "doSend: Ripple"; - - nothing(); - } - else if (!saSrcBalance.isPositive()) - { - // No native currency to send. - Log(lsINFO) << "doSend: No native currency to send: " << saSrcBalance.getText(); - - return rpcError(rpcINSUF_FUNDS); - } - else if (saDstAmount.isNative() && saSrcAmountMax < saDstAmount) - { - // Not enough native currency. - - Log(lsINFO) << "doSend: Insufficient funds: src=" << saSrcAmountMax.getText() << " dst=" << saDstAmount.getText(); - - return rpcError(rpcINSUF_FUNDS); - } - // XXX Don't allow send to self of same currency. - - Transaction::pointer trans; - if (asDst) { - // Destination exists, ordinary send. - - STPathSet spsPaths; - uint160 srcCurrencyID; - - if (!saSrcAmountMax.isNative() || !saDstAmount.isNative()) - { - STAmount::currencyFromString(srcCurrencyID, sSrcCurrency); - Pathfinder pf(naSrcAccountID, naDstAccountID, srcCurrencyID, saDstAmount); - pf.findPaths(5, 1, spsPaths); - } - - trans = Transaction::sharedPayment( - naAccountPublic, naAccountPrivate, - naSrcAccountID, - asSrc->getSeq(), - saFee, - 0, // YYY No source tag - naDstAccountID, - saDstAmount, - saSrcAmountMax, - spsPaths); - } - else - { - // Create destination and send. - - trans = Transaction::sharedCreate( - naAccountPublic, naAccountPrivate, - naSrcAccountID, - asSrc->getSeq(), - saFee, - 0, // YYY No source tag - naDstAccountID, - saDstAmount); // Initial funds in XNS. - } - - trans = mNetOps->submitTransaction(trans); - - obj["transaction"] = trans->getSTransaction()->getJson(0); - obj["status"] = trans->getStatus(); - obj["seed"] = naSeed.humanSeed(); - obj["fee"] = saFee.getText(); - obj["create"] = bCreate; - obj["srcAccountID"] = naSrcAccountID.humanAccountID(); - obj["dstAccountID"] = naDstAccountID.humanAccountID(); - obj["srcAmountMax"] = saSrcAmountMax.getText(); - obj["srcISO"] = saSrcAmountMax.getHumanCurrency(); - obj["dstAmount"] = saDstAmount.getText(); - obj["dstISO"] = saDstAmount.getHumanCurrency(); - - return obj; - } -} - Json::Value RPCHandler::doServerInfo(const Json::Value& params) { Json::Value ret(Json::objectValue); @@ -2328,255 +1254,6 @@ Json::Value RPCHandler::doWalletAccounts(const Json::Value& params) } } -// wallet_add [] [] -Json::Value RPCHandler::doWalletAdd(const Json::Value& params) -{ - RippleAddress naMasterSeed; - RippleAddress naRegularSeed; - RippleAddress naSrcAccountID; - STAmount saAmount; - std::string sDstCurrency; - - if (!naRegularSeed.setSeedGeneric(params[0u].asString())) - { - return rpcError(rpcBAD_SEED); - } - else if (!naSrcAccountID.setAccountID(params[1u].asString())) - { - return rpcError(rpcSRC_ACT_MALFORMED); - } - else if (!naMasterSeed.setSeedGeneric(params[2u].asString())) - { - return rpcError(rpcBAD_SEED); - } - else if (params.size() >= 4 && !saAmount.setFullValue(params[3u].asString(), sDstCurrency)) - { - return rpcError(rpcDST_AMT_MALFORMED); - } - else - { - RippleAddress naMasterGenerator = RippleAddress::createGeneratorPublic(naMasterSeed); - RippleAddress naRegularGenerator = RippleAddress::createGeneratorPublic(naRegularSeed); - - RippleAddress naAccountPublic; - RippleAddress naAccountPrivate; - AccountState::pointer asSrc; - STAmount saSrcBalance; - Json::Value obj = authorize(uint256(0), naRegularSeed, naSrcAccountID, naAccountPublic, naAccountPrivate, - saSrcBalance, theConfig.FEE_ACCOUNT_CREATE, asSrc, naMasterGenerator); - - if (!obj.empty()) - return obj; - - if (saSrcBalance < saAmount) - { - return rpcError(rpcINSUF_FUNDS); - } - else - { - RippleAddress naNewAccountPublic; - RippleAddress naNewAccountPrivate; - RippleAddress naAuthKeyID; - uint160 uAuthKeyID; - AccountState::pointer asNew; - std::vector vucSignature; - bool bAgain = true; - int iIndex = -1; - - // Find an unmade account. - do { - ++iIndex; - naNewAccountPublic.setAccountPublic(naMasterGenerator, iIndex); - - asNew = mNetOps->getAccountState(uint256(0), naNewAccountPublic); - if (!asNew) - bAgain = false; - } while (bAgain); - - // XXX Have a maximum number of accounts per wallet? - - // Determine corrisponding master private key. - naNewAccountPrivate.setAccountPrivate(naMasterGenerator, naMasterSeed, iIndex); - - // Determine new accounts authorized regular key. - naAuthKeyID.setAccountPublic(naRegularGenerator, iIndex); - - uAuthKeyID = naAuthKeyID.getAccountID(); - - // Sign anything (naAuthKeyID) to prove we know new master private key. - naNewAccountPrivate.accountPrivateSign(Serializer::getSHA512Half(uAuthKeyID.begin(), uAuthKeyID.size()), vucSignature); - - Transaction::pointer trans = Transaction::sharedWalletAdd( - naAccountPublic, naAccountPrivate, - naSrcAccountID, - asSrc->getSeq(), - theConfig.FEE_ACCOUNT_CREATE, - 0, // YYY No source tag - saAmount, - naAuthKeyID, - naNewAccountPublic, - vucSignature); - - trans = mNetOps->submitTransaction(trans); - - obj["transaction"] = trans->getSTransaction()->getJson(0); - obj["status"] = trans->getStatus(); - obj["srcAccountID"] = naSrcAccountID.humanAccountID(); - obj["newAccountID"] = naNewAccountPublic.humanAccountID(); - obj["amount"] = saAmount.getText(); - - return obj; - } - } -} - -// wallet_claim [] [] -// -// To provide an example to client writers, we do everything we expect a client to do here. -Json::Value RPCHandler::doWalletClaim(const Json::Value& params) -{ - RippleAddress naMasterSeed; - RippleAddress naRegularSeed; - - if (!naMasterSeed.setSeedGeneric(params[0u].asString())) - { - // Should also not allow account id's as seeds. - return rpcError(rpcBAD_SEED); - } - else if (!naRegularSeed.setSeedGeneric(params[1u].asString())) - { - // Should also not allow account id's as seeds. - return rpcError(rpcBAD_SEED); - } - else - { - // Building: - // peer_wallet_claim - // [] - // - // - // Which has no confidential information. - - // XXX Need better parsing. - uint32 uSourceTag = (params.size() == 2) ? 0 : lexical_cast_s(params[2u].asString()); - // XXX Annotation is ignored. - std::string strAnnotation = (params.size() == 3) ? "" : params[3u].asString(); - - RippleAddress naMasterGenerator = RippleAddress::createGeneratorPublic(naMasterSeed); - RippleAddress naRegularGenerator = RippleAddress::createGeneratorPublic(naRegularSeed); - RippleAddress naRegular0Public; - RippleAddress naRegular0Private; - - RippleAddress naAccountPublic; - RippleAddress naAccountPrivate; - - naAccountPublic.setAccountPublic(naMasterGenerator, 0); - naAccountPrivate.setAccountPrivate(naMasterGenerator, naMasterSeed, 0); - - naRegular0Public.setAccountPublic(naRegularGenerator, 0); - naRegular0Private.setAccountPrivate(naRegularGenerator, naRegularSeed, 0); - - // Hash of regular account #0 public key. - uint160 uGeneratorID = naRegular0Public.getAccountID(); - std::vector vucGeneratorCipher = naRegular0Private.accountPrivateEncrypt(naRegular0Public, naMasterGenerator.getGenerator()); - std::vector vucGeneratorSig; - - // Prove that we have the corresponding private key to the generator id. So, we can get the generator id. - // XXX Check result. - naRegular0Private.accountPrivateSign(Serializer::getSHA512Half(vucGeneratorCipher), vucGeneratorSig); - - Transaction::pointer trans = Transaction::sharedClaim( - naAccountPublic, naAccountPrivate, - uSourceTag, - vucGeneratorCipher, - naRegular0Public.getAccountPublic(), - vucGeneratorSig); - - trans = mNetOps->submitTransaction(trans); - - Json::Value obj(Json::objectValue); - - // We "echo" the seeds so they can be checked. - obj["master_seed"] = naMasterSeed.humanSeed(); - obj["master_key"] = naMasterSeed.humanSeed1751(); - obj["regular_seed"] = naRegularSeed.humanSeed(); - obj["regular_key"] = naRegularSeed.humanSeed1751(); - - obj["account_id"] = naAccountPublic.humanAccountID(); - obj["generator_id"] = strHex(uGeneratorID); - obj["generator"] = strHex(vucGeneratorCipher); - obj["annotation"] = strAnnotation; - - obj["transaction"] = trans->getSTransaction()->getJson(0); - obj["status"] = trans->getStatus(); - - return obj; - } -} - -// wallet_create regular_seed paying_account account_id [initial_funds] -// We don't allow creating an account_id by default here because we want to make sure the person has a chance to write down the -// master seed of the account to be created. -// YYY Need annotation and source tag -Json::Value RPCHandler::doWalletCreate(const Json::Value& params) -{ - RippleAddress naSrcAccountID; - RippleAddress naDstAccountID; - RippleAddress naSeed; - - if (!naSeed.setSeedGeneric(params[0u].asString())) - { - return rpcError(rpcBAD_SEED); - } - else if (!naSrcAccountID.setAccountID(params[1u].asString())) - { - return rpcError(rpcSRC_ACT_MALFORMED); - } - else if (!naDstAccountID.setAccountID(params[2u].asString())) - { - return rpcError(rpcDST_ACT_MALFORMED); - } - else if (mNetOps->getAccountState(uint256(0), naDstAccountID)) - { - return rpcError(rpcACT_EXISTS); - } - - // Trying to build: - // peer_wallet_create [] [] - - RippleAddress naMasterGenerator; - RippleAddress naAccountPublic; - RippleAddress naAccountPrivate; - AccountState::pointer asSrc; - STAmount saSrcBalance; - Json::Value obj = authorize(uint256(0), naSeed, naSrcAccountID, naAccountPublic, naAccountPrivate, - saSrcBalance, theConfig.FEE_ACCOUNT_CREATE, asSrc, naMasterGenerator); - - if (!obj.empty()) - return obj; - - STAmount saInitialFunds = (params.size() < 4) ? 0 : lexical_cast_s(params[3u].asString()); - - if (saSrcBalance < saInitialFunds) - return rpcError(rpcINSUF_FUNDS); - - Transaction::pointer trans = Transaction::sharedCreate( - naAccountPublic, naAccountPrivate, - naSrcAccountID, - asSrc->getSeq(), - theConfig.FEE_ACCOUNT_CREATE, - 0, // YYY No source tag - naDstAccountID, - saInitialFunds); // Initial funds in XNC. - - trans = mNetOps->submitTransaction(trans); - - obj["transaction"] = trans->getSTransaction()->getJson(0); - obj["status"] = trans->getStatus(); - - return obj; -} - Json::Value RPCHandler::doLogRotate(const Json::Value& params) { @@ -2596,13 +1273,8 @@ Json::Value RPCHandler::doCommand(const std::string& command, Json::Value& param unsigned int iOptions; } commandsA[] = { { "accept_ledger", &RPCHandler::doAcceptLedger, 0, 0, true }, - { "account_domain_set", &RPCHandler::doAccountDomainSet, 2, 3, false, optCurrent }, - { "account_email_set", &RPCHandler::doAccountEmailSet, 2, 3, false, optCurrent }, { "account_info", &RPCHandler::doAccountInfo, 1, 2, false, optCurrent }, - { "account_message_set", &RPCHandler::doAccountMessageSet, 3, 3, false, optCurrent }, - { "account_rate_set", &RPCHandler::doAccountRateSet, 3, 3, false, optCurrent }, { "account_tx", &RPCHandler::doAccountTransactions, 2, 3, false, optNetwork }, - { "account_wallet_set", &RPCHandler::doAccountWalletSet, 2, 3, false, optCurrent }, { "connect", &RPCHandler::doConnect, 1, 2, true }, { "data_delete", &RPCHandler::doDataDelete, 1, 1, true }, { "data_fetch", &RPCHandler::doDataFetch, 1, 1, true }, @@ -2612,18 +1284,10 @@ Json::Value RPCHandler::doCommand(const std::string& command, Json::Value& param { "log_level", &RPCHandler::doLogLevel, 0, 2, true }, { "logrotate", &RPCHandler::doLogRotate, 0, 0, true }, { "nickname_info", &RPCHandler::doNicknameInfo, 1, 1, false, optCurrent }, - { "nickname_set", &RPCHandler::doNicknameSet, 2, 3, false, optCurrent }, - { "offer_create", &RPCHandler::doOfferCreate, 9, 10, false, optCurrent }, - { "offer_cancel", &RPCHandler::doOfferCancel, 3, 3, false, optCurrent }, { "owner_info", &RPCHandler::doOwnerInfo, 1, 2, false, optCurrent }, - { "password_fund", &RPCHandler::doPasswordFund, 2, 3, false, optCurrent }, - { "password_set", &RPCHandler::doPasswordSet, 2, 3, false, optNetwork }, { "peers", &RPCHandler::doPeers, 0, 0, true }, { "profile", &RPCHandler::doProfile, 1, 9, false, optCurrent }, - { "ripple", &RPCHandler::doRipple, 9, -1, false, optCurrent|optClosed }, { "ripple_lines_get", &RPCHandler::doRippleLinesGet, 1, 2, false, optCurrent }, - { "ripple_line_set", &RPCHandler::doRippleLineSet, 4, 7, false, optCurrent }, - { "send", &RPCHandler::doSend, 3, 9, false, optCurrent }, { "submit", &RPCHandler::doSubmit, 2, 2, false, optCurrent }, { "server_info", &RPCHandler::doServerInfo, 0, 0, true }, { "stop", &RPCHandler::doStop, 0, 0, true }, @@ -2642,9 +1306,6 @@ Json::Value RPCHandler::doCommand(const std::string& command, Json::Value& param { "validation_seed", &RPCHandler::doValidationSeed, 0, 1, false }, { "wallet_accounts", &RPCHandler::doWalletAccounts, 1, 1, false, optCurrent }, - { "wallet_add", &RPCHandler::doWalletAdd, 3, 5, false, optCurrent }, - { "wallet_claim", &RPCHandler::doWalletClaim, 2, 4, false, optNetwork }, - { "wallet_create", &RPCHandler::doWalletCreate, 3, 4, false, optCurrent }, { "wallet_propose", &RPCHandler::doWalletPropose, 0, 1, false, }, { "wallet_seed", &RPCHandler::doWalletSeed, 0, 1, false, }, @@ -3224,5 +1885,4 @@ Json::Value RPCHandler::doLedgerEntry(const Json::Value& params) return jvResult; } - // vim:ts=4 diff --git a/src/RPCHandler.h b/src/RPCHandler.h index ea952dec9f..d66dc0e3d8 100644 --- a/src/RPCHandler.h +++ b/src/RPCHandler.h @@ -28,14 +28,9 @@ class RPCHandler Json::Value accountFromString(const uint256& uLedger, RippleAddress& naAccount, bool& bIndex, const std::string& strIdent, const int iIndex); Json::Value doAcceptLedger(const Json::Value ¶ms); - Json::Value doAccountDomainSet(const Json::Value ¶ms); - Json::Value doAccountEmailSet(const Json::Value ¶ms); + Json::Value doAccountInfo(const Json::Value& params); - Json::Value doAccountMessageSet(const Json::Value ¶ms); - Json::Value doAccountPublishSet(const Json::Value ¶ms); - Json::Value doAccountRateSet(const Json::Value ¶ms); Json::Value doAccountTransactions(const Json::Value& params); - Json::Value doAccountWalletSet(const Json::Value ¶ms); Json::Value doConnect(const Json::Value& params); Json::Value doDataDelete(const Json::Value& params); Json::Value doDataFetch(const Json::Value& params); @@ -44,24 +39,18 @@ class RPCHandler Json::Value doLedger(const Json::Value& params); Json::Value doLogRotate(const Json::Value& params); Json::Value doNicknameInfo(const Json::Value& params); - Json::Value doNicknameSet(const Json::Value& params); - Json::Value doOfferCreate(const Json::Value& params); - Json::Value doOfferCancel(const Json::Value& params); + Json::Value doOwnerInfo(const Json::Value& params); - Json::Value doPasswordFund(const Json::Value& params); - Json::Value doPasswordSet(const Json::Value& params); + Json::Value doProfile(const Json::Value& params); Json::Value doPeers(const Json::Value& params); - Json::Value doRipple(const Json::Value ¶ms); + Json::Value doRippleLinesGet(const Json::Value ¶ms); - Json::Value doRippleLineSet(const Json::Value& params); - Json::Value doSend(const Json::Value& params); Json::Value doServerInfo(const Json::Value& params); Json::Value doSessionClose(const Json::Value& params); Json::Value doSessionOpen(const Json::Value& params); Json::Value doLogLevel(const Json::Value& params); Json::Value doStop(const Json::Value& params); - Json::Value doTransitSet(const Json::Value& params); Json::Value doTx(const Json::Value& params); Json::Value doTxHistory(const Json::Value& params); Json::Value doSubmit(const Json::Value& params); @@ -80,9 +69,6 @@ class RPCHandler Json::Value doValidationSeed(const Json::Value& params); Json::Value doWalletAccounts(const Json::Value& params); - Json::Value doWalletAdd(const Json::Value& params); - Json::Value doWalletClaim(const Json::Value& params); - Json::Value doWalletCreate(const Json::Value& params); Json::Value doWalletLock(const Json::Value& params); Json::Value doWalletPropose(const Json::Value& params); Json::Value doWalletSeed(const Json::Value& params); @@ -91,8 +77,6 @@ class RPCHandler Json::Value doLogin(const Json::Value& params); - - Json::Value doLedgerAccept(const Json::Value& params); Json::Value doLedgerClosed(const Json::Value& params); Json::Value doLedgerCurrent(const Json::Value& params); diff --git a/src/WSConnection.cpp b/src/WSConnection.cpp index 603e178caa..c4baa67e34 100644 --- a/src/WSConnection.cpp +++ b/src/WSConnection.cpp @@ -277,9 +277,9 @@ void WSConnection::doUnsubscribe(Json::Value& jvResult, Json::Value& jvRequest) void WSConnection::doRPC(Json::Value& jvResult, Json::Value& jvRequest) { - if (jvRequest.isMember("command") && jvRequest.isMember("params")) + if (jvRequest.isMember("rpc_command") ) { - jvResult=theApp->getRPCHandler().doCommand(jvRequest["command"].asString(),jvRequest["params"],RPCHandler::GUEST); + jvResult=theApp->getRPCHandler().doCommand(jvRequest["rpc_command"].asString(),jvRequest["params"],RPCHandler::GUEST); }else jvResult["error"] = "fieldNotCommand";