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/impl/RPCHelpers.h>
27 #include <ripple/rpc/Role.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")
87 else if (streamName ==
"transactions_proposed"
88 || streamName ==
"rt_transactions")
92 else if (streamName ==
"validations")
96 else if (streamName ==
"peer_status")
100 else if (streamName ==
"consensus")
111 auto accountsProposed = context.
params.
isMember(jss::accounts_proposed)
112 ? jss::accounts_proposed : jss::rt_accounts;
140 for (
auto& jv: context.
params[jss::books])
142 if (! jv.isObject() ||
143 ! jv.isMember(jss::taker_pays) ||
144 ! jv.isMember(jss::taker_gets) ||
145 ! jv[jss::taker_pays].isObjectOrNull() ||
146 ! jv[jss::taker_gets].isObjectOrNull())
157 if (!taker_pays.
isMember (jss::currency)
161 JLOG (context.
j.
info()) <<
"Bad taker_pays currency.";
165 else if (((taker_pays.
isMember (jss::issuer))
166 && (!taker_pays[jss::issuer].
isString ()
173 JLOG (context.
j.
info()) <<
"Bad taker_pays issuer.";
179 if (!taker_gets.
isMember (jss::currency)
181 taker_gets[jss::currency].
asString ()))
183 JLOG (context.
j.
info()) <<
"Bad taker_gets currency.";
188 else if (((taker_gets.
isMember (jss::issuer))
189 && (!taker_gets[jss::issuer].
isString ()
191 taker_gets[jss::issuer].
asString ())))
196 JLOG (context.
j.
info()) <<
"Bad taker_gets issuer.";
201 if (book.
in == book.
out)
203 JLOG (context.
j.
info())
204 <<
"taker_gets same as taker_pays.";
211 if ((jv.isMember(jss::both) && jv[jss::both].asBool()) ||
212 (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.
bool isConsistent(Book const &book)
virtual bool unsubTransactions(std::uint64_t uListener)=0
virtual bool unsubConsensus(std::uint64_t uListener)=0
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 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
Json::Value rpcError(int iError, Json::Value jvResult)
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.