20 #include <ripple/protocol/TER.h>
21 #include <boost/range/adaptor/transformed.hpp>
38 #define MAKE_ERROR(code, desc) { code, { #code, desc } }
50 MAKE_ERROR(
tecAMM_ACCOUNT,
"This operation is not allowed on an AMM Account."),
51 MAKE_ERROR(
tecCLAIM,
"Fee claimed. Sequence used. No action."),
52 MAKE_ERROR(
tecDIR_FULL,
"Can not add entry to full directory."),
56 MAKE_ERROR(
tecNO_DST,
"Destination does not exist. Send XRP to create it."),
57 MAKE_ERROR(
tecNO_DST_INSUF_XRP,
"Destination does not exist. Too little XRP sent to create it."),
60 MAKE_ERROR(
tecPATH_DRY,
"Path could not send partial amount."),
62 MAKE_ERROR(
tecNO_ALTERNATIVE_KEY,
"The operation would remove the ability to sign transactions with the account."),
64 MAKE_ERROR(
tecOVERSIZE,
"Object exceeded serialization limits."),
65 MAKE_ERROR(
tecUNFUNDED,
"Not enough XRP to satisfy the reserve requirement."),
70 MAKE_ERROR(
tecOWNERS,
"Non-zero owner count."),
71 MAKE_ERROR(
tecNO_ISSUER,
"Issuer account does not exist."),
72 MAKE_ERROR(
tecNO_AUTH,
"Not authorized to hold asset."),
74 MAKE_ERROR(
tecINSUFF_FEE,
"Insufficient balance to pay fee."),
75 MAKE_ERROR(
tecFROZEN,
"Asset is frozen."),
76 MAKE_ERROR(
tecNO_TARGET,
"Target account does not exist."),
77 MAKE_ERROR(
tecNO_PERMISSION,
"No permission to perform requested operation."),
78 MAKE_ERROR(
tecNO_ENTRY,
"No matching entry found."),
82 MAKE_ERROR(
tecINTERNAL,
"An internal error has occurred during processing."),
84 MAKE_ERROR(
tecINVARIANT_FAILED,
"One or more invariants for the transaction were not satisfied."),
85 MAKE_ERROR(
tecEXPIRED,
"Expiration time is passed."),
86 MAKE_ERROR(
tecDUPLICATE,
"Ledger object already exists."),
87 MAKE_ERROR(
tecKILLED,
"No funds transferred and no offer created."),
88 MAKE_ERROR(
tecHAS_OBLIGATIONS,
"The account cannot be deleted since it has obligations."),
89 MAKE_ERROR(
tecTOO_SOON,
"It is too early to attempt the requested operation. Please wait."),
98 MAKE_ERROR(
tecINCOMPLETE,
"Some work was completed, but more submissions required to finish."),
100 MAKE_ERROR(
tefALREADY,
"The exact transaction was already in this ledger."),
102 MAKE_ERROR(
tefBAD_AUTH,
"Transaction's public key is not authorized."),
104 MAKE_ERROR(
tefBAD_QUORUM,
"Signatures provided do not meet the quorum."),
106 MAKE_ERROR(
tefCREATED,
"Can't add an already created account."),
114 MAKE_ERROR(
tefPAST_SEQ,
"This sequence number has already passed."),
115 MAKE_ERROR(
tefWRONG_PRIOR,
"This previous transaction does not match."),
116 MAKE_ERROR(
tefBAD_AUTH_MASTER,
"Auth for unclaimed account needs correct master key."),
118 MAKE_ERROR(
tefTOO_BIG,
"Transaction affects too many items."),
133 MAKE_ERROR(
telCAN_NOT_QUEUE_FEE,
"Can not queue at this time: fee insufficient to replace queued transaction."),
135 MAKE_ERROR(
telWRONG_NETWORK,
"Transaction specifies a Network ID that differs from that of the local node."),
136 MAKE_ERROR(
telREQUIRES_NETWORK_ID,
"Transactions submitted to this node/network must include a correct NetworkID field."),
141 MAKE_ERROR(
temBAD_AMOUNT,
"Can only send positive amounts."),
144 MAKE_ERROR(
temBAD_FEE,
"Invalid fee, negative or not XRP."),
146 MAKE_ERROR(
temBAD_LIMIT,
"Limits must be non-negative."),
150 MAKE_ERROR(
temBAD_QUORUM,
"Malformed: Quorum is unreachable."),
151 MAKE_ERROR(
temBAD_REGKEY,
"Malformed: Regular key cannot be same as master key."),
157 MAKE_ERROR(
temBAD_SEQUENCE,
"Malformed: Sequence is not in the past."),
159 MAKE_ERROR(
temBAD_SIGNER,
"Malformed: No signer may duplicate account or other signers."),
162 MAKE_ERROR(
temBAD_WEIGHT,
"Malformed: Weight must be a positive value."),
165 MAKE_ERROR(
temINVALID,
"The transaction is ill-formed."),
167 MAKE_ERROR(
temREDUNDANT,
"The transaction is redundant."),
169 MAKE_ERROR(
temUNCERTAIN,
"In process of determining result. Never returned."),
170 MAKE_ERROR(
temUNKNOWN,
"The transaction requires logic that is not implemented yet."),
171 MAKE_ERROR(
temDISABLED,
"The transaction requires logic that is currently disabled."),
175 MAKE_ERROR(
temINVALID_COUNT,
"Malformed: Count field outside valid range."),
176 MAKE_ERROR(
temSEQ_AND_TICKET,
"Transaction contains a TicketSequence and a non-zero Sequence."),
179 MAKE_ERROR(
terRETRY,
"Retry transaction."),
182 MAKE_ERROR(
terLAST,
"DEPRECATED."),
183 MAKE_ERROR(
terNO_RIPPLE,
"Path does not permit rippling."),
184 MAKE_ERROR(
terNO_ACCOUNT,
"The source account does not exist."),
185 MAKE_ERROR(
terNO_AUTH,
"Not authorized to hold IOUs."),
187 MAKE_ERROR(
terPRE_SEQ,
"Missing/inapplicable prior transaction."),
188 MAKE_ERROR(
terOWNERS,
"Non-zero owner count."),
189 MAKE_ERROR(
terQUEUED,
"Held until escalated fee drops."),
191 MAKE_ERROR(
terNO_AMM,
"AMM doesn't exist for the asset pair."),
192 MAKE_ERROR(
terSUBMITTED,
"Transaction has been submitted."),
194 MAKE_ERROR(
tesSUCCESS,
"The transaction was applied. Only final in a validated ledger."),
210 auto const r = results.find(
TERtoInt(code));
212 if (r == results.end())
215 token = r->second.first;
216 text = r->second.second;
241 static auto const results = [] {
243 auto range = boost::make_iterator_range(byTer.begin(), byTer.end());
244 auto tRange = boost::adaptors::transform(
range, [](
auto const& r) {
248 tRange.begin(), tRange.end());
252 auto const r = results.find(token);
254 if (r == results.end())
std::string transToken(TER code)
@ telNETWORK_ID_MAKES_TX_NON_CANONICAL
constexpr TERUnderlyingType TERtoInt(TELcodes v)
@ tecCANT_ACCEPT_OWN_NFTOKEN_OFFER
static std::unordered_map< TERUnderlyingType, std::pair< char const *const, char const *const > > const & transResults()
std::optional< TER > transCode(std::string const &token)
@ tecNFTOKEN_OFFER_TYPE_MISMATCH
@ temBAD_SEND_XRP_PARTIAL
@ tefNFTOKEN_IS_NOT_TRANSFERABLE
@ temBAD_SEND_XRP_NO_DIRECT
ClosedInterval< T > range(T low, T high)
Create a closed range interval.
@ telCAN_NOT_QUEUE_BLOCKS
std::string transHuman(TER code)
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
bool transResultInfo(TER code, std::string &token, std::string &text)
@ tecNFTOKEN_BUY_SELL_MISMATCH
@ tecNO_LINE_INSUF_RESERVE
@ tecINSUFFICIENT_PAYMENT
static constexpr TERSubset fromInt(int from)
@ tecNO_SUITABLE_NFTOKEN_PAGE
@ tecMAX_SEQUENCE_REACHED
@ tecINSUFFICIENT_RESERVE
@ telCAN_NOT_QUEUE_BALANCE
@ temBAD_NFTOKEN_TRANSFER_FEE
@ telCAN_NOT_QUEUE_BLOCKED
@ tecCRYPTOCONDITION_ERROR