20 #include <ripple/app/main/Application.h>
21 #include <ripple/app/misc/LoadFeeTrack.h>
22 #include <ripple/app/paths/TrustLine.h>
23 #include <ripple/ledger/ReadView.h>
24 #include <ripple/net/RPCErr.h>
25 #include <ripple/protocol/ErrorCodes.h>
26 #include <ripple/protocol/TxFlags.h>
27 #include <ripple/protocol/jss.h>
28 #include <ripple/rpc/Context.h>
29 #include <ripple/rpc/impl/RPCHelpers.h>
30 #include <ripple/rpc/impl/Tuning.h>
43 txArray[
"Account"] =
toBase58(accountID);
44 auto& fees = ledger.
fees();
63 auto const& params(context.
params);
64 if (!params.isMember(jss::account))
67 if (!params.isMember(
"role"))
69 bool roleGateway =
false;
72 if (role ==
"gateway")
74 else if (role !=
"user")
82 bool transactions =
false;
83 if (params.isMember(jss::transactions))
84 transactions = params[
"transactions"].asBool();
95 auto id = parseBase58<AccountID>(params[jss::account].asString());
101 auto const accountID{std::move(
id.value())};
112 if (bDefaultRipple & !roleGateway)
115 "You appear to have set your default ripple flag even though you "
116 "are not a gateway. This is not recommended unless you are "
119 else if (roleGateway & !bDefaultRipple)
121 problems.
append(
"You should immediately set your default ripple flag");
125 tx[
"TransactionType"] = jss::AccountSet;
140 bool const bLow = accountID ==
141 ownedItem->getFieldAmount(sfLowLimit).getIssuer();
143 bool const bNoRipple = ownedItem->getFieldU32(sfFlags) &
144 (bLow ? lsfLowNoRipple : lsfHighNoRipple);
147 bool needFix = false;
148 if (bNoRipple & roleGateway)
150 problem =
"You should clear the no ripple flag on your ";
153 else if (!roleGateway & !bNoRipple)
156 "You should probably set the no ripple flag on your ";
168 problem +=
" line to ";
177 tx[
"TransactionType"] = jss::TrustSet;
static constexpr LimitRange noRippleCheck
Limits for the no_ripple_check command.
Json::Value rpcError(int iError)
bool forEachItemAfter(ReadView const &view, Keylet const &root, uint256 const &after, std::uint64_t const hint, unsigned int limit, std::function< bool(std::shared_ptr< SLE const > const &)> const &f)
Iterate all items after an item in the given directory.
@ arrayValue
array value (ordered list)
const SF_UINT32 sfSequence
constexpr std::uint32_t tfSetNoRipple
virtual Fees const & fees() const =0
Returns the fees for the base ledger.
Json::Value getJson(JsonOptions) const override
std::string toBase58(AccountID const &v)
Convert AccountID to base58 checked string.
void setIssuer(AccountID const &uIssuer)
Status lookupLedger(std::shared_ptr< ReadView const > &ledger, JsonContext &context, Json::Value &result)
Look up a ledger from a request and fill a Json::Result with the data representing a ledger.
virtual LoadFeeTrack & getFeeTrack()=0
AccountID const & getIssuer() const
Json::Value missing_field_error(std::string const &name)
static void fillTransaction(RPC::JsonContext &context, Json::Value &txArray, AccountID const &accountID, std::uint32_t &sequence, ReadView const &ledger)
Integers of any length that is a multiple of 32-bits.
const SF_AMOUNT sfLowLimit
Value & append(const Value &value)
Append value to array at the end.
@ objectValue
object value (collection of name/value pairs).
Keylet account(AccountID const &id) noexcept
AccountID root.
constexpr std::uint32_t tfClearNoRipple
Json::Value doNoRippleCheck(RPC::JsonContext &)
const SF_AMOUNT sfHighLimit
LedgerEntryType getType() const
virtual std::shared_ptr< SLE const > read(Keylet const &k) const =0
Return the state item associated with a key.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
std::string to_string(Manifest const &m)
Format the specified manifest to a string for debugging purposes.
XRPAmount scaleFeeLoad(XRPAmount fee, LoadFeeTrack const &feeTrack, Fees const &fees, bool bUnlimited)
@ ltRIPPLE_STATE
A ledger object which describes a bidirectional trust line.
Currency const & getCurrency() const
void inject_error(error_code_i code, JsonValue &json)
Add or update the json update to reflect the error code.
Json::Value invalid_field_error(std::string const &name)
STAmount const & getFieldAmount(SField const &field) const
Json::Value jsonClipped() const