20#include <xrpl/protocol/TER.h> 
   22#include <boost/range/adaptor/transformed.hpp> 
   23#include <boost/range/iterator_range_core.hpp> 
   41#define MAKE_ERROR(code, desc) { code, { #code, desc } } 
   53        MAKE_ERROR(
tecAMM_ACCOUNT,                   
"This operation is not allowed on an AMM Account."),
 
   54        MAKE_ERROR(
tecCLAIM,                         
"Fee claimed. Sequence used. No action."),
 
   55        MAKE_ERROR(
tecDIR_FULL,                      
"Can not add entry to full directory."),
 
   59        MAKE_ERROR(
tecNO_DST,                        
"Destination does not exist. Send XRP to create it."),
 
   60        MAKE_ERROR(
tecNO_DST_INSUF_XRP,              
"Destination does not exist. Too little XRP sent to create it."),
 
   63        MAKE_ERROR(
tecPATH_DRY,                      
"Path could not send partial amount."),
 
   65        MAKE_ERROR(
tecNO_ALTERNATIVE_KEY,            
"The operation would remove the ability to sign transactions with the account."),
 
   67        MAKE_ERROR(
tecOVERSIZE,                      
"Object exceeded serialization limits."),
 
   68        MAKE_ERROR(
tecUNFUNDED,                      
"Not enough XRP to satisfy the reserve requirement."),
 
   73        MAKE_ERROR(
tecOWNERS,                        
"Non-zero owner count."),
 
   74        MAKE_ERROR(
tecNO_ISSUER,                     
"Issuer account does not exist."),
 
   75        MAKE_ERROR(
tecNO_AUTH,                       
"Not authorized to hold asset."),
 
   77        MAKE_ERROR(
tecINSUFF_FEE,                    
"Insufficient balance to pay fee."),
 
   78        MAKE_ERROR(
tecFROZEN,                        
"Asset is frozen."),
 
   79        MAKE_ERROR(
tecNO_TARGET,                     
"Target account does not exist."),
 
   80        MAKE_ERROR(
tecNO_PERMISSION,                 
"No permission to perform requested operation."),
 
   81        MAKE_ERROR(
tecNO_ENTRY,                      
"No matching entry found."),
 
   85        MAKE_ERROR(
tecINTERNAL,                      
"An internal error has occurred during processing."),
 
   87        MAKE_ERROR(
tecINVARIANT_FAILED,              
"One or more invariants for the transaction were not satisfied."),
 
   88        MAKE_ERROR(
tecEXPIRED,                       
"Expiration time is passed."),
 
   89        MAKE_ERROR(
tecDUPLICATE,                     
"Ledger object already exists."),
 
   90        MAKE_ERROR(
tecKILLED,                        
"No funds transferred and no offer created."),
 
   91        MAKE_ERROR(
tecHAS_OBLIGATIONS,               
"The account cannot be deleted since it has obligations."),
 
   92        MAKE_ERROR(
tecTOO_SOON,                      
"It is too early to attempt the requested operation. Please wait."),
 
  101        MAKE_ERROR(
tecINCOMPLETE,                    
"Some work was completed, but more submissions required to finish."),
 
  119        MAKE_ERROR(
tecEMPTY_DID,                     
"The DID object did not have a URI or DIDDocument field."),
 
  124        MAKE_ERROR(
tecLOCKED,                        
"Fund is locked."),
 
  128        MAKE_ERROR(
tecPSEUDO_ACCOUNT,                
"This operation is not allowed against a pseudo-account."),
 
  129        MAKE_ERROR(
tecPRECISION_LOSS,                
"The amounts used by the transaction cannot interact."),
 
  131        MAKE_ERROR(
tefALREADY,                     
"The exact transaction was already in this ledger."),
 
  133        MAKE_ERROR(
tefBAD_AUTH,                    
"Transaction's public key is not authorized."),
 
  135        MAKE_ERROR(
tefBAD_QUORUM,                  
"Signatures provided do not meet the quorum."),
 
  137        MAKE_ERROR(
tefCREATED,                     
"Can't add an already created account."),
 
  145        MAKE_ERROR(
tefPAST_SEQ,                    
"This sequence number has already passed."),
 
  146        MAKE_ERROR(
tefWRONG_PRIOR,                 
"This previous transaction does not match."),
 
  147        MAKE_ERROR(
tefBAD_AUTH_MASTER,             
"Auth for unclaimed account needs correct master key."),
 
  149        MAKE_ERROR(
tefTOO_BIG,                     
"Transaction affects too many items."),
 
  165        MAKE_ERROR(
telCAN_NOT_QUEUE_FEE,      
"Can not queue at this time: fee insufficient to replace queued transaction."),
 
  167        MAKE_ERROR(
telWRONG_NETWORK,          
"Transaction specifies a Network ID that differs from that of the local node."),
 
  168        MAKE_ERROR(
telREQUIRES_NETWORK_ID,    
"Transactions submitted to this node/network must include a correct NetworkID field."),
 
  177        MAKE_ERROR(
temBAD_FEE,                   
"Invalid fee, negative or not XRP."),
 
  179        MAKE_ERROR(
temBAD_LIMIT,                 
"Limits must be non-negative."),
 
  183        MAKE_ERROR(
temBAD_QUORUM,                
"Malformed: Quorum is unreachable."),
 
  184        MAKE_ERROR(
temBAD_REGKEY,                
"Malformed: Regular key cannot be same as master key."),
 
  190        MAKE_ERROR(
temBAD_SEQUENCE,              
"Malformed: Sequence is not in the past."),
 
  192        MAKE_ERROR(
temBAD_SIGNER,                
"Malformed: No signer may duplicate account or other signers."),
 
  195        MAKE_ERROR(
temBAD_WEIGHT,                
"Malformed: Weight must be a positive value."),
 
  198        MAKE_ERROR(
temEMPTY_DID,                 
"Malformed: No DID data provided."),
 
  199        MAKE_ERROR(
temINVALID,                   
"The transaction is ill-formed."),
 
  201        MAKE_ERROR(
temREDUNDANT,                 
"The transaction is redundant."),
 
  203        MAKE_ERROR(
temUNCERTAIN,                 
"In process of determining result. Never returned."),
 
  204        MAKE_ERROR(
temUNKNOWN,                   
"The transaction requires logic that is not implemented yet."),
 
  205        MAKE_ERROR(
temDISABLED,                  
"The transaction requires logic that is currently disabled."),
 
  209        MAKE_ERROR(
temINVALID_COUNT,             
"Malformed: Count field outside valid range."),
 
  210        MAKE_ERROR(
temSEQ_AND_TICKET,            
"Transaction contains a TicketSequence and a non-zero Sequence."),
 
  223        MAKE_ERROR(
terRETRY,                  
"Retry transaction."),
 
  226        MAKE_ERROR(
terLAST,                   
"DEPRECATED."),
 
  227        MAKE_ERROR(
terNO_RIPPLE,              
"Path does not permit rippling."),
 
  228        MAKE_ERROR(
terNO_ACCOUNT,             
"The source account does not exist."),
 
  229        MAKE_ERROR(
terNO_AUTH,                
"Not authorized to hold IOUs."),
 
  231        MAKE_ERROR(
terPRE_SEQ,                
"Missing/inapplicable prior transaction."),
 
  232        MAKE_ERROR(
terOWNERS,                 
"Non-zero owner count."),
 
  233        MAKE_ERROR(
terQUEUED,                 
"Held until escalated fee drops."),
 
  235        MAKE_ERROR(
terNO_AMM,                 
"AMM doesn't exist for the asset pair."),
 
  239        MAKE_ERROR(
tesSUCCESS,                
"The transaction was applied. Only final in a validated ledger."),
 
 
  253    auto const r = results.find(
TERtoInt(code));
 
  255    if (r == results.end())
 
  258    token = r->second.first;
 
  259    text = r->second.second;
 
 
  284    static auto const results = [] {
 
  286        auto range = boost::make_iterator_range(byTer.begin(), byTer.end());
 
  287        auto tRange = boost::adaptors::transform(
range, [](
auto const& r) {
 
  291            tRange.begin(), tRange.end());
 
  295    auto const r = results.find(token);
 
  297    if (r == results.end())
 
 
static constexpr TERSubset fromInt(int from)
 
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
 
std::string transHuman(TER code)
 
@ telCAN_NOT_QUEUE_BLOCKED
 
@ telNETWORK_ID_MAKES_TX_NON_CANONICAL
 
@ telCAN_NOT_QUEUE_BALANCE
 
@ telCAN_NOT_QUEUE_BLOCKS
 
@ tefNFTOKEN_IS_NOT_TRANSFERABLE
 
@ tefINVALID_LEDGER_FIX_TYPE
 
std::string transToken(TER code)
 
@ tecCRYPTOCONDITION_ERROR
 
@ tecNO_SUITABLE_NFTOKEN_PAGE
 
@ tecNO_LINE_INSUF_RESERVE
 
@ tecXCHAIN_INSUFF_CREATE_AMOUNT
 
@ tecXCHAIN_CREATE_ACCOUNT_DISABLED
 
@ tecXCHAIN_CREATE_ACCOUNT_NONXRP_ISSUE
 
@ tecNFTOKEN_OFFER_TYPE_MISMATCH
 
@ tecXCHAIN_PAYMENT_FAILED
 
@ tecXCHAIN_CLAIM_NO_QUORUM
 
@ tecXCHAIN_PROOF_UNKNOWN_KEY
 
@ tecNFTOKEN_BUY_SELL_MISMATCH
 
@ tecXCHAIN_ACCOUNT_CREATE_PAST
 
@ tecXCHAIN_BAD_TRANSFER_ISSUE
 
@ tecXCHAIN_REWARD_MISMATCH
 
@ tecMAX_SEQUENCE_REACHED
 
@ tecXCHAIN_SENDING_ACCOUNT_MISMATCH
 
@ tecINSUFFICIENT_PAYMENT
 
@ tecXCHAIN_BAD_PUBLIC_KEY_ACCOUNT_PAIR
 
@ tecXCHAIN_NO_SIGNERS_LIST
 
@ tecINSUFFICIENT_RESERVE
 
@ tecXCHAIN_ACCOUNT_CREATE_TOO_MANY
 
@ tecCANT_ACCEPT_OWN_NFTOKEN_OFFER
 
@ tecTOKEN_PAIR_NOT_FOUND
 
constexpr TERUnderlyingType TERtoInt(TELcodes v)
 
ClosedInterval< T > range(T low, T high)
Create a closed range interval.
 
std::unordered_map< TERUnderlyingType, std::pair< char const *const, char const *const > > const & transResults()
 
@ terNO_DELEGATE_PERMISSION
 
bool transResultInfo(TER code, std::string &token, std::string &text)
 
std::optional< TER > transCode(std::string const &token)
 
@ temBAD_SEND_XRP_PARTIAL
 
@ temXCHAIN_BRIDGE_BAD_MIN_ACCOUNT_CREATE_AMOUNT
 
@ temXCHAIN_BRIDGE_BAD_REWARD_AMOUNT
 
@ temXCHAIN_EQUAL_DOOR_ACCOUNTS
 
@ temXCHAIN_BRIDGE_NONDOOR_OWNER
 
@ temXCHAIN_BRIDGE_BAD_ISSUES
 
@ temBAD_SEND_XRP_NO_DIRECT
 
@ temBAD_NFTOKEN_TRANSFER_FEE