1#include <xrpl/protocol/TER.h>
3#include <boost/range/adaptor/transformed.hpp>
4#include <boost/range/iterator_range_core.hpp>
13std::unordered_map<TERUnderlyingType, std::pair<char const* const, char const* const>>
const&
20#define MAKE_ERROR(code, desc) { code, { #code, desc } }
32 MAKE_ERROR(
tecAMM_ACCOUNT,
"This operation is not allowed on an AMM Account."),
33 MAKE_ERROR(
tecCLAIM,
"Fee claimed. Sequence used. No action."),
34 MAKE_ERROR(
tecDIR_FULL,
"Can not add entry to full directory."),
38 MAKE_ERROR(
tecNO_DST,
"Destination does not exist. Send XRP to create it."),
39 MAKE_ERROR(
tecNO_DST_INSUF_XRP,
"Destination does not exist. Too little XRP sent to create it."),
42 MAKE_ERROR(
tecPATH_DRY,
"Path could not send partial amount."),
44 MAKE_ERROR(
tecNO_ALTERNATIVE_KEY,
"The operation would remove the ability to sign transactions with the account."),
46 MAKE_ERROR(
tecOVERSIZE,
"Object exceeded serialization limits."),
47 MAKE_ERROR(
tecUNFUNDED,
"Not enough XRP to satisfy the reserve requirement."),
52 MAKE_ERROR(
tecOWNERS,
"Non-zero owner count."),
53 MAKE_ERROR(
tecNO_ISSUER,
"Issuer account does not exist."),
54 MAKE_ERROR(
tecNO_AUTH,
"Not authorized to hold asset."),
56 MAKE_ERROR(
tecINSUFF_FEE,
"Insufficient balance to pay fee."),
57 MAKE_ERROR(
tecFROZEN,
"Asset is frozen."),
58 MAKE_ERROR(
tecNO_TARGET,
"Target account does not exist."),
59 MAKE_ERROR(
tecNO_PERMISSION,
"No permission to perform requested operation."),
60 MAKE_ERROR(
tecNO_ENTRY,
"No matching entry found."),
64 MAKE_ERROR(
tecINTERNAL,
"An internal error has occurred during processing."),
66 MAKE_ERROR(
tecINVARIANT_FAILED,
"One or more invariants for the transaction were not satisfied."),
67 MAKE_ERROR(
tecEXPIRED,
"Expiration time is passed."),
68 MAKE_ERROR(
tecDUPLICATE,
"Ledger object already exists."),
69 MAKE_ERROR(
tecKILLED,
"No funds transferred and no offer created."),
70 MAKE_ERROR(
tecHAS_OBLIGATIONS,
"The account cannot be deleted since it has obligations."),
71 MAKE_ERROR(
tecTOO_SOON,
"It is too early to attempt the requested operation. Please wait."),
80 MAKE_ERROR(
tecINCOMPLETE,
"Some work was completed, but more submissions required to finish."),
98 MAKE_ERROR(
tecEMPTY_DID,
"The DID object did not have a URI or DIDDocument field."),
103 MAKE_ERROR(
tecLOCKED,
"Fund is locked."),
107 MAKE_ERROR(
tecPSEUDO_ACCOUNT,
"This operation is not allowed against a pseudo-account."),
108 MAKE_ERROR(
tecPRECISION_LOSS,
"The amounts used by the transaction cannot interact."),
111 MAKE_ERROR(
tecOUT_OF_GAS,
"The WASM code ran out of gas during execution."),
112 MAKE_ERROR(
tecBYTECODE_REJECTED,
"The custom WASM code that was run rejected your transaction."),
114 MAKE_ERROR(
tefALREADY,
"The exact transaction was already in this ledger."),
116 MAKE_ERROR(
tefBAD_AUTH,
"Transaction's public key is not authorized."),
118 MAKE_ERROR(
tefBAD_QUORUM,
"Signatures provided do not meet the quorum."),
120 MAKE_ERROR(
tefCREATED,
"Can't add an already created account."),
128 MAKE_ERROR(
tefPAST_SEQ,
"This sequence number has already passed."),
129 MAKE_ERROR(
tefWRONG_PRIOR,
"This previous transaction does not match."),
130 MAKE_ERROR(
tefBAD_AUTH_MASTER,
"Auth for unclaimed account needs correct master key."),
132 MAKE_ERROR(
tefTOO_BIG,
"Transaction affects too many items."),
138 MAKE_ERROR(
tefNO_BYTECODE,
"There is no WASM code to run, but a WASM-specific field was included."),
152 MAKE_ERROR(
telCAN_NOT_QUEUE_FEE,
"Can not queue at this time: fee insufficient to replace queued transaction."),
154 MAKE_ERROR(
telWRONG_NETWORK,
"Transaction specifies a Network ID that differs from that of the local node."),
155 MAKE_ERROR(
telREQUIRES_NETWORK_ID,
"Transactions submitted to this node/network must include a correct NetworkID field."),
164 MAKE_ERROR(
temBAD_FEE,
"Invalid fee, negative or not XRP."),
166 MAKE_ERROR(
temBAD_LIMIT,
"Limits must be non-negative."),
167 MAKE_ERROR(
temBAD_MPT,
"Malformed: Bad MPT."),
171 MAKE_ERROR(
temBAD_QUORUM,
"Malformed: Quorum is unreachable."),
172 MAKE_ERROR(
temBAD_REGKEY,
"Malformed: Regular key cannot be same as master key."),
178 MAKE_ERROR(
temBAD_SEQUENCE,
"Malformed: Sequence is not in the past."),
180 MAKE_ERROR(
temBAD_SIGNER,
"Malformed: No signer may duplicate account or other signers."),
183 MAKE_ERROR(
temBAD_WEIGHT,
"Malformed: Weight must be a positive value."),
186 MAKE_ERROR(
temEMPTY_DID,
"Malformed: No DID data provided."),
187 MAKE_ERROR(
temINVALID,
"The transaction is ill-formed."),
189 MAKE_ERROR(
temREDUNDANT,
"The transaction is redundant."),
191 MAKE_ERROR(
temUNCERTAIN,
"In process of determining result. Never returned."),
192 MAKE_ERROR(
temUNKNOWN,
"The transaction requires logic that is not implemented yet."),
193 MAKE_ERROR(
temDISABLED,
"The transaction requires logic that is currently disabled."),
197 MAKE_ERROR(
temINVALID_COUNT,
"Malformed: Count field outside valid range."),
198 MAKE_ERROR(
temSEQ_AND_TICKET,
"Transaction contains a TicketSequence and a non-zero Sequence."),
212 MAKE_ERROR(
temTEMP_DISABLED,
"The transaction requires logic that is currently temporarily disabled."),
214 MAKE_ERROR(
terRETRY,
"Retry transaction."),
217 MAKE_ERROR(
terLAST,
"DEPRECATED."),
218 MAKE_ERROR(
terNO_RIPPLE,
"Path does not permit rippling."),
219 MAKE_ERROR(
terNO_ACCOUNT,
"The source account does not exist."),
220 MAKE_ERROR(
terNO_AUTH,
"Not authorized to hold IOUs."),
222 MAKE_ERROR(
terPRE_SEQ,
"Missing/inapplicable prior transaction."),
223 MAKE_ERROR(
terOWNERS,
"Non-zero owner count."),
224 MAKE_ERROR(
terQUEUED,
"Held until escalated fee drops."),
226 MAKE_ERROR(
terNO_AMM,
"AMM doesn't exist for the asset pair."),
229 MAKE_ERROR(
terLOCKED,
"Fund is locked."),
230 MAKE_ERROR(
terNO_PERMISSION,
"No permission to perform requested operation."),
232 MAKE_ERROR(
tesSUCCESS,
"The transaction was applied. Only final in a validated ledger."),
246 auto const r = results.find(
TERtoInt(code));
248 if (r == results.end())
251 token = r->second.first;
252 text = r->second.second;
277 static auto const kResults = [] {
279 auto range = boost::make_iterator_range(byTer.begin(), byTer.end());
280 auto tRange = boost::adaptors::transform(
283 tRange.begin(), tRange.end());
287 auto const r = kResults.find(token);
289 if (r == kResults.end())
static constexpr TERSubset fromInt(int from)
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
@ telNETWORK_ID_MAKES_TX_NON_CANONICAL
@ telCAN_NOT_QUEUE_BLOCKED
@ telCAN_NOT_QUEUE_BALANCE
@ telCAN_NOT_QUEUE_BLOCKS
@ terNO_DELEGATE_PERMISSION
ClosedInterval< T > range(T low, T high)
Create a closed range interval.
@ tefINVALID_LEDGER_FIX_TYPE
@ tefBYTECODE_NOT_INCLUDED
@ tefNFTOKEN_IS_NOT_TRANSFERABLE
std::string transHuman(TER code)
bool transResultInfo(TER code, std::string &token, std::string &text)
std::string transToken(TER code)
std::unordered_map< TERUnderlyingType, std::pair< char const *const, char const *const > > const & transResults()
constexpr TERUnderlyingType TERtoInt(TELcodes v)
@ temBAD_SEND_XRP_PARTIAL
@ temXCHAIN_BRIDGE_BAD_MIN_ACCOUNT_CREATE_AMOUNT
@ temXCHAIN_BRIDGE_NONDOOR_OWNER
@ temBAD_SEND_XRP_NO_DIRECT
@ temXCHAIN_BRIDGE_BAD_ISSUES
@ temXCHAIN_BRIDGE_BAD_REWARD_AMOUNT
@ temBAD_NFTOKEN_TRANSFER_FEE
@ temXCHAIN_EQUAL_DOOR_ACCOUNTS
TERSubset< CanCvtToTER > TER
std::optional< TER > transCode(std::string const &token)
@ tecXCHAIN_INSUFF_CREATE_AMOUNT
@ tecCANT_ACCEPT_OWN_NFTOKEN_OFFER
@ tecNO_LINE_INSUF_RESERVE
@ tecXCHAIN_NO_SIGNERS_LIST
@ tecXCHAIN_SENDING_ACCOUNT_MISMATCH
@ tecXCHAIN_BAD_TRANSFER_ISSUE
@ tecNO_SPONSOR_PERMISSION
@ tecNO_SUITABLE_NFTOKEN_PAGE
@ tecXCHAIN_PROOF_UNKNOWN_KEY
@ tecXCHAIN_ACCOUNT_CREATE_PAST
@ tecXCHAIN_PAYMENT_FAILED
@ tecXCHAIN_ACCOUNT_CREATE_TOO_MANY
@ tecNFTOKEN_BUY_SELL_MISMATCH
@ tecXCHAIN_CREATE_ACCOUNT_NONXRP_ISSUE
@ tecCRYPTOCONDITION_ERROR
@ tecXCHAIN_BAD_PUBLIC_KEY_ACCOUNT_PAIR
@ tecNFTOKEN_OFFER_TYPE_MISMATCH
@ tecXCHAIN_CREATE_ACCOUNT_DISABLED
@ tecINSUFFICIENT_RESERVE
@ tecXCHAIN_CLAIM_NO_QUORUM
@ tecXCHAIN_REWARD_MISMATCH
@ tecMAX_SEQUENCE_REACHED
@ tecTOKEN_PAIR_NOT_FOUND
@ tecINSUFFICIENT_PAYMENT