20 #include <ripple/app/misc/NetworkOPs.h>
21 #include <ripple/basics/Log.h>
22 #include <ripple/net/RPCErr.h>
23 #include <ripple/protocol/ErrorCodes.h>
24 #include <ripple/protocol/jss.h>
25 #include <ripple/rpc/Context.h>
26 #include <ripple/rpc/Role.h>
27 #include <ripple/rpc/impl/RPCHelpers.h>
36 bool removeUrl{
false};
65 for (
auto& it : context.
params[jss::streams])
71 if (streamName ==
"server")
75 else if (streamName ==
"ledger")
79 else if (streamName ==
"manifests")
83 else if (streamName ==
"transactions")
88 streamName ==
"transactions_proposed" ||
89 streamName ==
"rt_transactions")
93 else if (streamName ==
"validations")
97 else if (streamName ==
"peer_status")
101 else if (streamName ==
"consensus")
112 auto accountsProposed = context.
params.
isMember(jss::accounts_proposed)
113 ? jss::accounts_proposed
139 auto const& req = context.
params[jss::account_history_tx_stream];
140 if (!req.isMember(jss::account) || !req[jss::account].isString())
143 auto const id = parseBase58<AccountID>(req[jss::account].asString());
147 bool stopHistoryOnly =
false;
148 if (req.isMember(jss::stop_history_tx_only))
150 if (!req[jss::stop_history_tx_only].isBool())
152 stopHistoryOnly = req[jss::stop_history_tx_only].asBool();
157 <<
"doUnsubscribe: account_history_tx_stream: " <<
toBase58(*
id)
158 <<
" stopHistoryOnly=" << (stopHistoryOnly ?
"true" :
"false");
166 for (
auto& jv : context.
params[jss::books])
168 if (!jv.isObject() || !jv.isMember(jss::taker_pays) ||
169 !jv.isMember(jss::taker_gets) ||
170 !jv[jss::taker_pays].isObjectOrNull() ||
171 !jv[jss::taker_gets].isObjectOrNull())
182 if (!taker_pays.
isMember(jss::currency) ||
186 JLOG(context.
j.
info()) <<
"Bad taker_pays currency.";
191 ((taker_pays.
isMember(jss::issuer)) &&
192 (!taker_pays[jss::issuer].
isString() ||
198 JLOG(context.
j.
info()) <<
"Bad taker_pays issuer.";
204 if (!taker_gets.
isMember(jss::currency) ||
208 JLOG(context.
j.
info()) <<
"Bad taker_gets currency.";
214 ((taker_gets.
isMember(jss::issuer)) &&
215 (!taker_gets[jss::issuer].
isString() ||
221 JLOG(context.
j.
info()) <<
"Bad taker_gets issuer.";
226 if (book.
in == book.
out)
228 JLOG(context.
j.
info()) <<
"taker_gets same as taker_pays.";
235 if ((jv.isMember(jss::both) && jv[jss::both].asBool()) ||
236 (jv.isMember(jss::both_sides) && jv[jss::both_sides].asBool()))
bool to_currency(Currency ¤cy, std::string const &code)
Tries to convert a string to a Currency, returns true on success.
Json::Value rpcError(int iError)
bool isConsistent(Book const &book)
virtual bool unsubTransactions(std::uint64_t uListener)=0
virtual bool unsubConsensus(std::uint64_t uListener)=0
std::string toBase58(AccountID const &v)
Convert AccountID to base58 checked string.
virtual bool unsubValidations(std::uint64_t uListener)=0
virtual pointer findRpcSub(std::string const &strUrl)=0
@ objectValue
object value (collection of name/value pairs).
virtual bool unsubBook(std::uint64_t uListener, Book const &)=0
Book reversed(Book const &book)
virtual void unsubAccountHistory(ref ispListener, AccountID const &account, bool historyOnly)=0
unsubscribe an account's transactions
virtual void unsubAccount(ref isplistener, hash_set< AccountID > const &vnaAccountIDs, bool realTime)=0
bool isMember(const char *key) const
Return true if the object has a member named key.
virtual bool unsubRTTransactions(std::uint64_t uListener)=0
virtual bool unsubPeerStatus(std::uint64_t uListener)=0
virtual bool unsubServer(std::uint64_t uListener)=0
Json::Value doUnsubscribe(RPC::JsonContext &)
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
virtual bool unsubManifests(std::uint64_t uListener)=0
virtual bool tryRemoveRpcSub(std::string const &strUrl)=0
hash_set< AccountID > parseAccountIds(Json::Value const &jvArray)
AccountID const & noAccount()
A placeholder for empty accounts.
bool to_issuer(AccountID &, std::string const &)
Convert hex or base58 string to AccountID.
virtual bool unsubLedger(std::uint64_t uListener)=0
std::string asString() const
Returns the unquoted string value.