mirror of
https://github.com/XRPLF/rippled.git
synced 2026-03-06 04:42:30 +00:00
Compare commits
29 Commits
a1q123456/
...
ximinez/as
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5c1b94f1d3 | ||
|
|
d2f23b2f5b | ||
|
|
4067e5025f | ||
|
|
0017eb345a | ||
|
|
ed4330a7d6 | ||
|
|
c2ca6907d4 | ||
|
|
feba605998 | ||
|
|
b322097529 | ||
|
|
e159d27373 | ||
|
|
ba53026006 | ||
|
|
34773080df | ||
|
|
3a30099db6 | ||
|
|
3c3bd75991 | ||
|
|
6766a176a3 | ||
|
|
7459fe454d | ||
|
|
ecb2ba5e19 | ||
|
|
106bf48725 | ||
|
|
74c968d4e3 | ||
|
|
167147281c | ||
|
|
ba60306610 | ||
|
|
6674500896 | ||
|
|
c5d7ebe93d | ||
|
|
8b4404b8c6 | ||
|
|
bfc0acc734 | ||
|
|
9f7f43c16e | ||
|
|
8e98ba7564 | ||
|
|
d0b5ca9dab | ||
|
|
5e51893e9b | ||
|
|
3422c11d02 |
@@ -19,7 +19,6 @@ libxrpl.nodestore > xrpl.protocol
|
||||
libxrpl.protocol > xrpl.basics
|
||||
libxrpl.protocol > xrpl.json
|
||||
libxrpl.protocol > xrpl.protocol
|
||||
libxrpl.protocol_autogen > xrpl.protocol_autogen
|
||||
libxrpl.rdb > xrpl.basics
|
||||
libxrpl.rdb > xrpl.rdb
|
||||
libxrpl.resource > xrpl.basics
|
||||
@@ -191,8 +190,6 @@ xrpl.nodestore > xrpl.basics
|
||||
xrpl.nodestore > xrpl.protocol
|
||||
xrpl.protocol > xrpl.basics
|
||||
xrpl.protocol > xrpl.json
|
||||
xrpl.protocol_autogen > xrpl.json
|
||||
xrpl.protocol_autogen > xrpl.protocol
|
||||
xrpl.rdb > xrpl.basics
|
||||
xrpl.rdb > xrpl.core
|
||||
xrpl.rdb > xrpl.protocol
|
||||
|
||||
3
.gitignore
vendored
3
.gitignore
vendored
@@ -80,6 +80,3 @@ DerivedData
|
||||
|
||||
# clangd cache
|
||||
/.cache
|
||||
|
||||
# python cache
|
||||
__pycache__
|
||||
|
||||
@@ -14,11 +14,8 @@ repos:
|
||||
rev: 3e8a8703264a2f4a69428a0aa4dcb512790b2c8c # frozen: v6.0.0
|
||||
hooks:
|
||||
- id: trailing-whitespace
|
||||
exclude: ^include/xrpl/protocol_autogen/(transactions|ledger_objects)/
|
||||
- id: end-of-file-fixer
|
||||
exclude: ^include/xrpl/protocol_autogen/(transactions|ledger_objects)/
|
||||
- id: mixed-line-ending
|
||||
exclude: ^include/xrpl/protocol_autogen/(transactions|ledger_objects)/
|
||||
- id: check-merge-conflict
|
||||
args: [--assume-in-merge]
|
||||
|
||||
@@ -28,7 +25,6 @@ repos:
|
||||
- id: clang-format
|
||||
args: [--style=file]
|
||||
"types_or": [c++, c, proto]
|
||||
exclude: ^include/xrpl/protocol_autogen/(transactions|ledger_objects)/
|
||||
|
||||
- repo: https://github.com/cheshirekow/cmake-format-precommit
|
||||
rev: e2c2116d86a80e72e7146a06e68b7c228afc6319 # frozen: v0.6.13
|
||||
@@ -50,7 +46,7 @@ repos:
|
||||
rev: a42085ade523f591dca134379a595e7859986445 # frozen: v9.7.0
|
||||
hooks:
|
||||
- id: cspell # Spell check changed files
|
||||
exclude: (.config/cspell.config.yaml|^include/xrpl/protocol_autogen/(transactions|ledger_objects)/)
|
||||
exclude: .config/cspell.config.yaml
|
||||
- id: cspell # Spell check the commit message
|
||||
name: check commit message spelling
|
||||
args:
|
||||
|
||||
@@ -22,19 +22,6 @@ API version 2 is available in `rippled` version 2.0.0 and later. See [API-VERSIO
|
||||
|
||||
This version is supported by all `rippled` versions. For WebSocket and HTTP JSON-RPC requests, it is currently the default API version used when no `api_version` is specified.
|
||||
|
||||
## Unreleased
|
||||
|
||||
This section contains changes targeting a future version.
|
||||
|
||||
### Additions
|
||||
|
||||
- `server_definitions`: Added the following new sections to the response ([#6321](https://github.com/XRPLF/rippled/pull/6321)):
|
||||
- `TRANSACTION_FORMATS`: Describes the fields and their optionality for each transaction type, including common fields shared across all transactions.
|
||||
- `LEDGER_ENTRY_FORMATS`: Describes the fields and their optionality for each ledger entry type, including common fields shared across all ledger entries.
|
||||
- `TRANSACTION_FLAGS`: Maps transaction type names to their supported flags and flag values.
|
||||
- `LEDGER_ENTRY_FLAGS`: Maps ledger entry type names to their flags and flag values.
|
||||
- `ACCOUNT_SET_FLAGS`: Maps AccountSet flag names (asf flags) to their numeric values.
|
||||
|
||||
## XRP Ledger server version 3.1.0
|
||||
|
||||
[Version 3.1.0](https://github.com/XRPLF/rippled/releases/tag/3.1.0) was released on Jan 27, 2026.
|
||||
|
||||
@@ -81,23 +81,15 @@ target_link_libraries(xrpl.libxrpl.protocol PUBLIC xrpl.libxrpl.crypto xrpl.libx
|
||||
xrpl.libxrpl.json)
|
||||
|
||||
# Level 05
|
||||
## Set up code generation for protocol_autogen module
|
||||
include(XrplProtocolAutogen)
|
||||
setup_protocol_autogen()
|
||||
|
||||
add_module(xrpl protocol_autogen)
|
||||
target_link_libraries(xrpl.libxrpl.protocol_autogen PUBLIC xrpl.libxrpl.protocol)
|
||||
|
||||
# Level 06
|
||||
add_module(xrpl core)
|
||||
target_link_libraries(xrpl.libxrpl.core PUBLIC xrpl.libxrpl.basics xrpl.libxrpl.json
|
||||
xrpl.libxrpl.protocol xrpl.libxrpl.protocol_autogen)
|
||||
xrpl.libxrpl.protocol)
|
||||
|
||||
# Level 07
|
||||
# Level 06
|
||||
add_module(xrpl resource)
|
||||
target_link_libraries(xrpl.libxrpl.resource PUBLIC xrpl.libxrpl.protocol)
|
||||
|
||||
# Level 08
|
||||
# Level 07
|
||||
add_module(xrpl net)
|
||||
target_link_libraries(xrpl.libxrpl.net PUBLIC xrpl.libxrpl.basics xrpl.libxrpl.json
|
||||
xrpl.libxrpl.protocol xrpl.libxrpl.resource)
|
||||
@@ -126,7 +118,6 @@ target_link_libraries(
|
||||
PUBLIC xrpl.libxrpl.basics
|
||||
xrpl.libxrpl.json
|
||||
xrpl.libxrpl.protocol
|
||||
xrpl.libxrpl.protocol_autogen
|
||||
xrpl.libxrpl.rdb
|
||||
xrpl.libxrpl.server
|
||||
xrpl.libxrpl.shamap
|
||||
@@ -157,7 +148,6 @@ target_link_modules(
|
||||
net
|
||||
nodestore
|
||||
protocol
|
||||
protocol_autogen
|
||||
rdb
|
||||
resource
|
||||
server
|
||||
|
||||
@@ -30,7 +30,6 @@ install(TARGETS common
|
||||
xrpl.libxrpl.net
|
||||
xrpl.libxrpl.nodestore
|
||||
xrpl.libxrpl.protocol
|
||||
xrpl.libxrpl.protocol_autogen
|
||||
xrpl.libxrpl.resource
|
||||
xrpl.libxrpl.server
|
||||
xrpl.libxrpl.shamap
|
||||
|
||||
@@ -1,155 +0,0 @@
|
||||
#[===================================================================[
|
||||
Protocol Autogen - Code generation for protocol wrapper classes
|
||||
#]===================================================================]
|
||||
|
||||
# Options for code generation
|
||||
set(CODEGEN_VENV_DIR
|
||||
""
|
||||
CACHE PATH
|
||||
"Path to Python virtual environment for code generation. If provided, automatic venv setup is skipped."
|
||||
)
|
||||
|
||||
# Function to set up code generation for protocol_autogen module
|
||||
# This runs at configure time to generate C++ wrapper classes from macro files
|
||||
function (setup_protocol_autogen)
|
||||
# Directory paths
|
||||
set(MACRO_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include/xrpl/protocol/detail")
|
||||
set(AUTOGEN_HEADER_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include/xrpl/protocol_autogen")
|
||||
set(SCRIPTS_DIR "${CMAKE_CURRENT_SOURCE_DIR}/scripts")
|
||||
|
||||
# Input macro files
|
||||
set(TRANSACTIONS_MACRO "${MACRO_DIR}/transactions.macro")
|
||||
set(LEDGER_ENTRIES_MACRO "${MACRO_DIR}/ledger_entries.macro")
|
||||
set(SFIELDS_MACRO "${MACRO_DIR}/sfields.macro")
|
||||
|
||||
# Python scripts
|
||||
set(GENERATE_TX_SCRIPT "${SCRIPTS_DIR}/generate_tx_classes.py")
|
||||
set(GENERATE_LEDGER_SCRIPT "${SCRIPTS_DIR}/generate_ledger_classes.py")
|
||||
set(REQUIREMENTS_FILE "${SCRIPTS_DIR}/requirements.txt")
|
||||
|
||||
# Create output directories
|
||||
file(MAKE_DIRECTORY "${AUTOGEN_HEADER_DIR}/transactions")
|
||||
file(MAKE_DIRECTORY "${AUTOGEN_HEADER_DIR}/ledger_objects")
|
||||
|
||||
# Find Python3 - check if already found by Conan or find it ourselves
|
||||
if (NOT Python3_EXECUTABLE)
|
||||
find_package(Python3 COMPONENTS Interpreter QUIET)
|
||||
endif ()
|
||||
|
||||
if (NOT Python3_EXECUTABLE)
|
||||
# Try finding python3 executable directly
|
||||
find_program(Python3_EXECUTABLE NAMES python3 python)
|
||||
endif ()
|
||||
|
||||
if (NOT Python3_EXECUTABLE)
|
||||
message(FATAL_ERROR "Python3 not found. Code generation cannot proceed.")
|
||||
return()
|
||||
endif ()
|
||||
|
||||
message(STATUS "Using Python3 for code generation: ${Python3_EXECUTABLE}")
|
||||
|
||||
# Set up Python virtual environment for code generation
|
||||
if (CODEGEN_VENV_DIR)
|
||||
# User-provided venv - skip automatic setup
|
||||
set(VENV_DIR "${CODEGEN_VENV_DIR}")
|
||||
message(STATUS "Using user-provided Python venv: ${VENV_DIR}")
|
||||
else ()
|
||||
# Use default venv in build directory
|
||||
set(VENV_DIR "${CMAKE_CURRENT_BINARY_DIR}/codegen_venv")
|
||||
endif ()
|
||||
|
||||
# Determine the Python executable path in the venv
|
||||
if (WIN32)
|
||||
set(VENV_PYTHON "${VENV_DIR}/Scripts/python.exe")
|
||||
set(VENV_PIP "${VENV_DIR}/Scripts/pip.exe")
|
||||
else ()
|
||||
set(VENV_PYTHON "${VENV_DIR}/bin/python")
|
||||
set(VENV_PIP "${VENV_DIR}/bin/pip")
|
||||
endif ()
|
||||
|
||||
# Only auto-setup venv if not user-provided
|
||||
if (NOT CODEGEN_VENV_DIR)
|
||||
# Check if venv needs to be created or updated
|
||||
set(VENV_NEEDS_UPDATE FALSE)
|
||||
if (NOT EXISTS "${VENV_PYTHON}")
|
||||
set(VENV_NEEDS_UPDATE TRUE)
|
||||
message(STATUS "Creating Python virtual environment for code generation...")
|
||||
elseif ("${REQUIREMENTS_FILE}" IS_NEWER_THAN "${VENV_DIR}/.requirements_installed")
|
||||
set(VENV_NEEDS_UPDATE TRUE)
|
||||
message(STATUS "Updating Python virtual environment (requirements changed)...")
|
||||
endif ()
|
||||
|
||||
# Create/update virtual environment if needed
|
||||
if (VENV_NEEDS_UPDATE)
|
||||
message(STATUS "Setting up Python virtual environment at ${VENV_DIR}")
|
||||
execute_process(COMMAND ${Python3_EXECUTABLE} -m venv "${VENV_DIR}"
|
||||
RESULT_VARIABLE VENV_RESULT ERROR_VARIABLE VENV_ERROR)
|
||||
if (NOT VENV_RESULT EQUAL 0)
|
||||
message(FATAL_ERROR "Failed to create virtual environment: ${VENV_ERROR}")
|
||||
endif ()
|
||||
|
||||
message(STATUS "Installing Python dependencies...")
|
||||
execute_process(COMMAND ${VENV_PIP} install --upgrade pip
|
||||
RESULT_VARIABLE PIP_UPGRADE_RESULT OUTPUT_QUIET
|
||||
ERROR_VARIABLE PIP_UPGRADE_ERROR)
|
||||
if (NOT PIP_UPGRADE_RESULT EQUAL 0)
|
||||
message(WARNING "Failed to upgrade pip: ${PIP_UPGRADE_ERROR}")
|
||||
endif ()
|
||||
|
||||
execute_process(COMMAND ${VENV_PIP} install -r "${REQUIREMENTS_FILE}"
|
||||
RESULT_VARIABLE PIP_INSTALL_RESULT ERROR_VARIABLE PIP_INSTALL_ERROR)
|
||||
if (NOT PIP_INSTALL_RESULT EQUAL 0)
|
||||
message(FATAL_ERROR "Failed to install Python dependencies: ${PIP_INSTALL_ERROR}")
|
||||
endif ()
|
||||
|
||||
# Mark requirements as installed
|
||||
file(TOUCH "${VENV_DIR}/.requirements_installed")
|
||||
message(STATUS "Python virtual environment ready")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
# Generate transaction classes at configure time
|
||||
message(STATUS "Generating transaction classes from transactions.macro...")
|
||||
execute_process(COMMAND ${VENV_PYTHON} "${GENERATE_TX_SCRIPT}" "${TRANSACTIONS_MACRO}"
|
||||
--header-dir "${AUTOGEN_HEADER_DIR}/transactions" --sfields-macro
|
||||
"${SFIELDS_MACRO}"
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
RESULT_VARIABLE TX_GEN_RESULT
|
||||
OUTPUT_VARIABLE TX_GEN_OUTPUT
|
||||
ERROR_VARIABLE TX_GEN_ERROR)
|
||||
if (NOT TX_GEN_RESULT EQUAL 0)
|
||||
message(FATAL_ERROR "Failed to generate transaction classes:\n${TX_GEN_ERROR}")
|
||||
else ()
|
||||
message(STATUS "Transaction classes generated successfully")
|
||||
endif ()
|
||||
|
||||
# Generate ledger entry classes at configure time
|
||||
message(STATUS "Generating ledger entry classes from ledger_entries.macro...")
|
||||
execute_process(COMMAND ${VENV_PYTHON} "${GENERATE_LEDGER_SCRIPT}" "${LEDGER_ENTRIES_MACRO}"
|
||||
--header-dir "${AUTOGEN_HEADER_DIR}/ledger_objects" --sfields-macro
|
||||
"${SFIELDS_MACRO}"
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
RESULT_VARIABLE LEDGER_GEN_RESULT
|
||||
OUTPUT_VARIABLE LEDGER_GEN_OUTPUT
|
||||
ERROR_VARIABLE LEDGER_GEN_ERROR)
|
||||
if (NOT LEDGER_GEN_RESULT EQUAL 0)
|
||||
message(FATAL_ERROR "Failed to generate ledger entry classes:\n${LEDGER_GEN_ERROR}")
|
||||
else ()
|
||||
message(STATUS "Ledger entry classes generated successfully")
|
||||
endif ()
|
||||
|
||||
# Register dependencies so CMake reconfigures when these files change
|
||||
set_property(DIRECTORY
|
||||
APPEND
|
||||
PROPERTY CMAKE_CONFIGURE_DEPENDS
|
||||
"${TRANSACTIONS_MACRO}"
|
||||
"${LEDGER_ENTRIES_MACRO}"
|
||||
"${SFIELDS_MACRO}"
|
||||
"${GENERATE_TX_SCRIPT}"
|
||||
"${GENERATE_LEDGER_SCRIPT}"
|
||||
"${SCRIPTS_DIR}/macro_parser_common.py"
|
||||
"${SCRIPTS_DIR}/templates/Transaction.h.mako"
|
||||
"${SCRIPTS_DIR}/templates/LedgerEntry.h.mako"
|
||||
"${REQUIREMENTS_FILE}")
|
||||
|
||||
endfunction ()
|
||||
@@ -30,11 +30,9 @@ public:
|
||||
Item(
|
||||
char const* name,
|
||||
KeyType type,
|
||||
std::vector<SOElement> uniqueFields,
|
||||
std::vector<SOElement> commonFields)
|
||||
: soTemplate_(std::move(uniqueFields), std::move(commonFields))
|
||||
, name_(name)
|
||||
, type_(type)
|
||||
std::initializer_list<SOElement> uniqueFields,
|
||||
std::initializer_list<SOElement> commonFields)
|
||||
: soTemplate_(uniqueFields, commonFields), name_(name), type_(type)
|
||||
{
|
||||
// Verify that KeyType is appropriate.
|
||||
static_assert(
|
||||
@@ -144,16 +142,16 @@ protected:
|
||||
|
||||
@param name The name of this format.
|
||||
@param type The type of this format.
|
||||
@param uniqueFields A std::vector of unique fields
|
||||
@param commonFields A std::vector of common fields
|
||||
@param uniqueFields An std::initializer_list of unique fields
|
||||
@param commonFields An std::initializer_list of common fields
|
||||
|
||||
@return The created format.
|
||||
*/
|
||||
Item const&
|
||||
add(char const* name,
|
||||
KeyType type,
|
||||
std::vector<SOElement> uniqueFields,
|
||||
std::vector<SOElement> commonFields = {})
|
||||
std::initializer_list<SOElement> uniqueFields,
|
||||
std::initializer_list<SOElement> commonFields = {})
|
||||
{
|
||||
if (auto const item = findByType(type))
|
||||
{
|
||||
@@ -162,7 +160,7 @@ protected:
|
||||
item->getName());
|
||||
}
|
||||
|
||||
formats_.emplace_front(name, type, std::move(uniqueFields), std::move(commonFields));
|
||||
formats_.emplace_front(name, type, uniqueFields, commonFields);
|
||||
Item const& item{formats_.front()};
|
||||
|
||||
names_[name] = &item;
|
||||
|
||||
@@ -2,34 +2,36 @@
|
||||
|
||||
#include <xrpl/protocol/KnownFormats.h>
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace xrpl {
|
||||
|
||||
/** Identifiers for on-ledger objects.
|
||||
|
||||
Each ledger object requires a unique type identifier, which is stored within the object itself;
|
||||
this makes it possible to iterate the entire ledger and determine each object's type and verify
|
||||
that the object you retrieved from a given hash matches the expected type.
|
||||
Each ledger object requires a unique type identifier, which is stored
|
||||
within the object itself; this makes it possible to iterate the entire
|
||||
ledger and determine each object's type and verify that the object you
|
||||
retrieved from a given hash matches the expected type.
|
||||
|
||||
@warning Since these values are stored inside objects stored on the ledger they are part of the
|
||||
protocol.
|
||||
**Changing them should be avoided because without special handling, this will result in a hard
|
||||
@warning Since these values are stored inside objects stored on the ledger
|
||||
they are part of the protocol. **Changing them should be avoided
|
||||
because without special handling, this will result in a hard
|
||||
fork.**
|
||||
|
||||
@note Values outside this range may be used internally by the code for various purposes, but
|
||||
attempting to use such values to identify on-ledger objects will result in an invariant failure.
|
||||
@note Values outside this range may be used internally by the code for
|
||||
various purposes, but attempting to use such values to identify
|
||||
on-ledger objects will results in an invariant failure.
|
||||
|
||||
@note When retiring types, the specific values should not be removed but should be marked as
|
||||
[[deprecated]]. This is to avoid accidental reuse of identifiers.
|
||||
@note When retiring types, the specific values should not be removed but
|
||||
should be marked as [[deprecated]]. This is to avoid accidental
|
||||
reuse of identifiers.
|
||||
|
||||
@todo The C++ language does not enable checking for duplicate values here.
|
||||
If it becomes possible then we should do this.
|
||||
@todo The C++ language does not enable checking for duplicate values
|
||||
here. If it becomes possible then we should do this.
|
||||
|
||||
@ingroup protocol
|
||||
*/
|
||||
enum LedgerEntryType : std::uint16_t {
|
||||
// clang-format off
|
||||
enum LedgerEntryType : std::uint16_t
|
||||
{
|
||||
|
||||
#pragma push_macro("LEDGER_ENTRY")
|
||||
#undef LEDGER_ENTRY
|
||||
@@ -44,10 +46,12 @@ enum LedgerEntryType : std::uint16_t {
|
||||
//---------------------------------------------------------------------------
|
||||
/** A special type, matching any ledger entry type.
|
||||
|
||||
The value does not represent a concrete type, but rather is used in contexts where the
|
||||
specific type of a ledger object is unimportant, unknown or unavailable.
|
||||
The value does not represent a concrete type, but rather is used in
|
||||
contexts where the specific type of a ledger object is unimportant,
|
||||
unknown or unavailable.
|
||||
|
||||
Objects with this special type cannot be created or stored on the ledger.
|
||||
Objects with this special type cannot be created or stored on the
|
||||
ledger.
|
||||
|
||||
\sa keylet::unchecked
|
||||
*/
|
||||
@@ -55,11 +59,12 @@ enum LedgerEntryType : std::uint16_t {
|
||||
|
||||
/** A special type, matching any ledger type except directory nodes.
|
||||
|
||||
The value does not represent a concrete type, but rather is used in contexts where the
|
||||
ledger object must not be a directory node but its specific type is otherwise unimportant,
|
||||
unknown or unavailable.
|
||||
The value does not represent a concrete type, but rather is used in
|
||||
contexts where the ledger object must not be a directory node but
|
||||
its specific type is otherwise unimportant, unknown or unavailable.
|
||||
|
||||
Objects with this special type cannot be created or stored on the ledger.
|
||||
Objects with this special type cannot be created or stored on the
|
||||
ledger.
|
||||
|
||||
\sa keylet::child
|
||||
*/
|
||||
@@ -88,188 +93,104 @@ enum LedgerEntryType : std::uint16_t {
|
||||
Support for this type of object was never implemented.
|
||||
No objects of this type were ever created.
|
||||
*/
|
||||
ltGENERATOR_MAP [[deprecated("This object type is not supported and should not be used.")]] =
|
||||
0x0067,
|
||||
ltGENERATOR_MAP [[deprecated("This object type is not supported and should not be used.")]] = 0x0067,
|
||||
};
|
||||
|
||||
/** Ledger object flags.
|
||||
|
||||
These flags are specified in ledger objects and modify their behavior.
|
||||
|
||||
@warning Ledger object flags form part of the protocol.
|
||||
**Changing them should be avoided because without special handling, this will result in a hard
|
||||
fork.**
|
||||
|
||||
@ingroup protocol
|
||||
*/
|
||||
#pragma push_macro("XMACRO")
|
||||
#pragma push_macro("TO_VALUE")
|
||||
#pragma push_macro("VALUE_TO_MAP")
|
||||
#pragma push_macro("NULL_NAME")
|
||||
#pragma push_macro("TO_MAP")
|
||||
#pragma push_macro("ALL_LEDGER_FLAGS")
|
||||
|
||||
#undef XMACRO
|
||||
#undef TO_VALUE
|
||||
#undef VALUE_TO_MAP
|
||||
#undef NULL_NAME
|
||||
#undef TO_MAP
|
||||
|
||||
#undef ALL_LEDGER_FLAGS
|
||||
|
||||
// clang-format off
|
||||
|
||||
#define XMACRO(LEDGER_OBJECT, LSF_FLAG, LSF_FLAG2) \
|
||||
LEDGER_OBJECT(AccountRoot, \
|
||||
LSF_FLAG(lsfPasswordSpent, 0x00010000) /* True, if password set fee is spent. */ \
|
||||
LSF_FLAG(lsfRequireDestTag, 0x00020000) /* True, to require a DestinationTag for payments. */ \
|
||||
LSF_FLAG(lsfRequireAuth, 0x00040000) /* True, to require a authorization to hold IOUs. */ \
|
||||
LSF_FLAG(lsfDisallowXRP, 0x00080000) /* True, to disallow sending XRP. */ \
|
||||
LSF_FLAG(lsfDisableMaster, 0x00100000) /* True, force regular key */ \
|
||||
LSF_FLAG(lsfNoFreeze, 0x00200000) /* True, cannot freeze ripple states */ \
|
||||
LSF_FLAG(lsfGlobalFreeze, 0x00400000) /* True, all assets frozen */ \
|
||||
LSF_FLAG(lsfDefaultRipple, 0x00800000) /* True, incoming trust lines allow rippling by default */ \
|
||||
LSF_FLAG(lsfDepositAuth, 0x01000000) /* True, all deposits require authorization */ \
|
||||
LSF_FLAG(lsfDisallowIncomingNFTokenOffer, 0x04000000) /* True, reject new incoming NFT offers */ \
|
||||
LSF_FLAG(lsfDisallowIncomingCheck, 0x08000000) /* True, reject new checks */ \
|
||||
LSF_FLAG(lsfDisallowIncomingPayChan, 0x10000000) /* True, reject new paychans */ \
|
||||
LSF_FLAG(lsfDisallowIncomingTrustline, 0x20000000) /* True, reject new trustlines (only if no issued assets) */ \
|
||||
LSF_FLAG(lsfAllowTrustLineLocking, 0x40000000) /* True, enable trustline locking */ \
|
||||
LSF_FLAG(lsfAllowTrustLineClawback, 0x80000000)) /* True, enable clawback */ \
|
||||
\
|
||||
LEDGER_OBJECT(Offer, \
|
||||
LSF_FLAG(lsfPassive, 0x00010000) \
|
||||
LSF_FLAG(lsfSell, 0x00020000) /* True, offer was placed as a sell. */ \
|
||||
LSF_FLAG(lsfHybrid, 0x00040000)) /* True, offer is hybrid. */ \
|
||||
\
|
||||
LEDGER_OBJECT(RippleState, \
|
||||
LSF_FLAG(lsfLowReserve, 0x00010000) /* True, if entry counts toward reserve. */ \
|
||||
LSF_FLAG(lsfHighReserve, 0x00020000) \
|
||||
LSF_FLAG(lsfLowAuth, 0x00040000) \
|
||||
LSF_FLAG(lsfHighAuth, 0x00080000) \
|
||||
LSF_FLAG(lsfLowNoRipple, 0x00100000) \
|
||||
LSF_FLAG(lsfHighNoRipple, 0x00200000) \
|
||||
LSF_FLAG(lsfLowFreeze, 0x00400000) /* True, low side has set freeze flag */ \
|
||||
LSF_FLAG(lsfHighFreeze, 0x00800000) /* True, high side has set freeze flag */ \
|
||||
LSF_FLAG(lsfAMMNode, 0x01000000) /* True, trust line to AMM. */ \
|
||||
/* Used by client apps to identify payments via AMM. */ \
|
||||
LSF_FLAG(lsfLowDeepFreeze, 0x02000000) /* True, low side has set deep freeze flag */ \
|
||||
LSF_FLAG(lsfHighDeepFreeze, 0x04000000)) /* True, high side has set deep freeze flag */ \
|
||||
\
|
||||
LEDGER_OBJECT(SignerList, \
|
||||
LSF_FLAG(lsfOneOwnerCount, 0x00010000)) /* True, uses only one OwnerCount */ \
|
||||
\
|
||||
LEDGER_OBJECT(DirNode, \
|
||||
LSF_FLAG(lsfNFTokenBuyOffers, 0x00000001) \
|
||||
LSF_FLAG(lsfNFTokenSellOffers, 0x00000002)) \
|
||||
\
|
||||
LEDGER_OBJECT(NFTokenOffer, \
|
||||
LSF_FLAG(lsfSellNFToken, 0x00000001)) \
|
||||
\
|
||||
LEDGER_OBJECT(MPTokenIssuance, \
|
||||
LSF_FLAG(lsfMPTLocked, 0x00000001) /* Also used in ltMPTOKEN */ \
|
||||
LSF_FLAG(lsfMPTCanLock, 0x00000002) \
|
||||
LSF_FLAG(lsfMPTRequireAuth, 0x00000004) \
|
||||
LSF_FLAG(lsfMPTCanEscrow, 0x00000008) \
|
||||
LSF_FLAG(lsfMPTCanTrade, 0x00000010) \
|
||||
LSF_FLAG(lsfMPTCanTransfer, 0x00000020) \
|
||||
LSF_FLAG(lsfMPTCanClawback, 0x00000040)) \
|
||||
\
|
||||
LEDGER_OBJECT(MPTokenIssuanceMutable, \
|
||||
LSF_FLAG(lsmfMPTCanMutateCanLock, 0x00000002) \
|
||||
LSF_FLAG(lsmfMPTCanMutateRequireAuth, 0x00000004) \
|
||||
LSF_FLAG(lsmfMPTCanMutateCanEscrow, 0x00000008) \
|
||||
LSF_FLAG(lsmfMPTCanMutateCanTrade, 0x00000010) \
|
||||
LSF_FLAG(lsmfMPTCanMutateCanTransfer, 0x00000020) \
|
||||
LSF_FLAG(lsmfMPTCanMutateCanClawback, 0x00000040) \
|
||||
LSF_FLAG(lsmfMPTCanMutateMetadata, 0x00010000) \
|
||||
LSF_FLAG(lsmfMPTCanMutateTransferFee, 0x00020000)) \
|
||||
\
|
||||
LEDGER_OBJECT(MPToken, \
|
||||
LSF_FLAG2(lsfMPTLocked, 0x00000001) \
|
||||
LSF_FLAG(lsfMPTAuthorized, 0x00000002)) \
|
||||
\
|
||||
LEDGER_OBJECT(Credential, \
|
||||
LSF_FLAG(lsfAccepted, 0x00010000)) \
|
||||
\
|
||||
LEDGER_OBJECT(Vault, \
|
||||
LSF_FLAG(lsfVaultPrivate, 0x00010000)) \
|
||||
\
|
||||
LEDGER_OBJECT(Loan, \
|
||||
LSF_FLAG(lsfLoanDefault, 0x00010000) \
|
||||
LSF_FLAG(lsfLoanImpaired, 0x00020000) \
|
||||
LSF_FLAG(lsfLoanOverpayment, 0x00040000)) /* True, loan allows overpayments */
|
||||
/**
|
||||
@ingroup protocol
|
||||
*/
|
||||
enum LedgerSpecificFlags {
|
||||
// ltACCOUNT_ROOT
|
||||
lsfPasswordSpent = 0x00010000, // True, if password set fee is spent.
|
||||
lsfRequireDestTag =
|
||||
0x00020000, // True, to require a DestinationTag for payments.
|
||||
lsfRequireAuth =
|
||||
0x00040000, // True, to require a authorization to hold IOUs.
|
||||
lsfDisallowXRP = 0x00080000, // True, to disallow sending XRP.
|
||||
lsfDisableMaster = 0x00100000, // True, force regular key
|
||||
lsfNoFreeze = 0x00200000, // True, cannot freeze ripple states
|
||||
lsfGlobalFreeze = 0x00400000, // True, all assets frozen
|
||||
lsfDefaultRipple =
|
||||
0x00800000, // True, incoming trust lines allow rippling by default
|
||||
lsfDepositAuth = 0x01000000, // True, all deposits require authorization
|
||||
/* // reserved for Hooks amendment
|
||||
lsfTshCollect = 0x02000000, // True, allow TSH collect-calls to acc hooks
|
||||
*/
|
||||
lsfDisallowIncomingNFTokenOffer =
|
||||
0x04000000, // True, reject new incoming NFT offers
|
||||
lsfDisallowIncomingCheck =
|
||||
0x08000000, // True, reject new checks
|
||||
lsfDisallowIncomingPayChan =
|
||||
0x10000000, // True, reject new paychans
|
||||
lsfDisallowIncomingTrustline =
|
||||
0x20000000, // True, reject new trustlines (only if no issued assets)
|
||||
lsfAllowTrustLineLocking =
|
||||
0x40000000, // True, enable trustline locking
|
||||
lsfAllowTrustLineClawback =
|
||||
0x80000000, // True, enable clawback
|
||||
|
||||
// clang-format on
|
||||
// ltOFFER
|
||||
lsfPassive = 0x00010000,
|
||||
lsfSell = 0x00020000, // True, offer was placed as a sell.
|
||||
lsfHybrid = 0x00040000, // True, offer is hybrid.
|
||||
|
||||
// Create all the flag values as an enum.
|
||||
//
|
||||
// example:
|
||||
// enum LedgerSpecificFlags {
|
||||
// lsfPasswordSpent = 0x00010000,
|
||||
// lsfRequireDestTag = 0x00020000,
|
||||
// ...
|
||||
// };
|
||||
#define TO_VALUE(name, value) name = value,
|
||||
#define NULL_NAME(name, values) values
|
||||
#define NULL_OUTPUT(name, value)
|
||||
enum LedgerSpecificFlags : std::uint32_t { XMACRO(NULL_NAME, TO_VALUE, NULL_OUTPUT) };
|
||||
// ltRIPPLE_STATE
|
||||
lsfLowReserve = 0x00010000, // True, if entry counts toward reserve.
|
||||
lsfHighReserve = 0x00020000,
|
||||
lsfLowAuth = 0x00040000,
|
||||
lsfHighAuth = 0x00080000,
|
||||
lsfLowNoRipple = 0x00100000,
|
||||
lsfHighNoRipple = 0x00200000,
|
||||
lsfLowFreeze = 0x00400000, // True, low side has set freeze flag
|
||||
lsfHighFreeze = 0x00800000, // True, high side has set freeze flag
|
||||
lsfLowDeepFreeze = 0x02000000, // True, low side has set deep freeze flag
|
||||
lsfHighDeepFreeze = 0x04000000, // True, high side has set deep freeze flag
|
||||
lsfAMMNode = 0x01000000, // True, trust line to AMM. Used by client
|
||||
// apps to identify payments via AMM.
|
||||
|
||||
// Create getter functions for each set of flags using Meyer's singleton pattern.
|
||||
// This avoids static initialization order fiasco while still providing efficient access.
|
||||
// This is used below in `getAllLedgerFlags()` to generate the server_definitions RPC output.
|
||||
//
|
||||
// example:
|
||||
// inline LedgerFlagMap const& getAccountRootFlags() {
|
||||
// static LedgerFlagMap const flags = {
|
||||
// {"lsfPasswordSpent", 0x00010000},
|
||||
// {"lsfRequireDestTag", 0x00020000},
|
||||
// ...};
|
||||
// return flags;
|
||||
// }
|
||||
using LedgerFlagMap = std::map<std::string, std::uint32_t>;
|
||||
#define VALUE_TO_MAP(name, value) {#name, value},
|
||||
#define TO_MAP(name, values) \
|
||||
inline LedgerFlagMap const& get##name##Flags() \
|
||||
{ \
|
||||
static LedgerFlagMap const flags = {values}; \
|
||||
return flags; \
|
||||
}
|
||||
XMACRO(TO_MAP, VALUE_TO_MAP, VALUE_TO_MAP)
|
||||
// ltSIGNER_LIST
|
||||
lsfOneOwnerCount = 0x00010000, // True, uses only one OwnerCount
|
||||
|
||||
// Create a getter function for all ledger flag maps using Meyer's singleton pattern.
|
||||
// This is used to generate the server_definitions RPC output.
|
||||
//
|
||||
// example:
|
||||
// inline std::vector<std::pair<std::string, LedgerFlagMap>> const& getAllLedgerFlags() {
|
||||
// static std::vector<std::pair<std::string, LedgerFlagMap>> const flags = {
|
||||
// {"AccountRoot", getAccountRootFlags()},
|
||||
// ...};
|
||||
// return flags;
|
||||
// }
|
||||
#define ALL_LEDGER_FLAGS(name, values) {#name, get##name##Flags()},
|
||||
inline std::vector<std::pair<std::string, LedgerFlagMap>> const&
|
||||
getAllLedgerFlags()
|
||||
{
|
||||
static std::vector<std::pair<std::string, LedgerFlagMap>> const flags = {
|
||||
XMACRO(ALL_LEDGER_FLAGS, NULL_OUTPUT, NULL_OUTPUT)};
|
||||
return flags;
|
||||
}
|
||||
// ltDIR_NODE
|
||||
lsfNFTokenBuyOffers = 0x00000001,
|
||||
lsfNFTokenSellOffers = 0x00000002,
|
||||
|
||||
#undef XMACRO
|
||||
#undef TO_VALUE
|
||||
#undef VALUE_TO_MAP
|
||||
#undef NULL_NAME
|
||||
#undef NULL_OUTPUT
|
||||
#undef TO_MAP
|
||||
#undef ALL_LEDGER_FLAGS
|
||||
// ltNFTOKEN_OFFER
|
||||
lsfSellNFToken = 0x00000001,
|
||||
|
||||
#pragma pop_macro("XMACRO")
|
||||
#pragma pop_macro("TO_VALUE")
|
||||
#pragma pop_macro("VALUE_TO_MAP")
|
||||
#pragma pop_macro("NULL_NAME")
|
||||
#pragma pop_macro("TO_MAP")
|
||||
#pragma pop_macro("ALL_LEDGER_FLAGS")
|
||||
// ltMPTOKEN_ISSUANCE
|
||||
lsfMPTLocked = 0x00000001, // Also used in ltMPTOKEN
|
||||
lsfMPTCanLock = 0x00000002,
|
||||
lsfMPTRequireAuth = 0x00000004,
|
||||
lsfMPTCanEscrow = 0x00000008,
|
||||
lsfMPTCanTrade = 0x00000010,
|
||||
lsfMPTCanTransfer = 0x00000020,
|
||||
lsfMPTCanClawback = 0x00000040,
|
||||
|
||||
lsmfMPTCanMutateCanLock = 0x00000002,
|
||||
lsmfMPTCanMutateRequireAuth = 0x00000004,
|
||||
lsmfMPTCanMutateCanEscrow = 0x00000008,
|
||||
lsmfMPTCanMutateCanTrade = 0x00000010,
|
||||
lsmfMPTCanMutateCanTransfer = 0x00000020,
|
||||
lsmfMPTCanMutateCanClawback = 0x00000040,
|
||||
lsmfMPTCanMutateMetadata = 0x00010000,
|
||||
lsmfMPTCanMutateTransferFee = 0x00020000,
|
||||
|
||||
// ltMPTOKEN
|
||||
lsfMPTAuthorized = 0x00000002,
|
||||
|
||||
// ltCREDENTIAL
|
||||
lsfAccepted = 0x00010000,
|
||||
|
||||
// ltVAULT
|
||||
lsfVaultPrivate = 0x00010000,
|
||||
|
||||
// ltLOAN
|
||||
lsfLoanDefault = 0x00010000,
|
||||
lsfLoanImpaired = 0x00020000,
|
||||
lsfLoanOverpayment = 0x00040000, // True, loan allows overpayments
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
@@ -286,10 +207,6 @@ private:
|
||||
public:
|
||||
static LedgerFormats const&
|
||||
getInstance();
|
||||
|
||||
// Fields shared by all ledger entry formats:
|
||||
static std::vector<SOElement> const&
|
||||
getCommonFields();
|
||||
};
|
||||
|
||||
} // namespace xrpl
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
#include <functional>
|
||||
#include <initializer_list>
|
||||
#include <stdexcept>
|
||||
#include <vector>
|
||||
|
||||
namespace xrpl {
|
||||
|
||||
@@ -98,12 +97,8 @@ public:
|
||||
operator=(SOTemplate&& other) = default;
|
||||
|
||||
/** Create a template populated with all fields.
|
||||
After creating the template fields cannot be added, modified, or removed.
|
||||
*/
|
||||
SOTemplate(std::vector<SOElement> uniqueFields, std::vector<SOElement> commonFields = {});
|
||||
|
||||
/** Create a template populated with all fields.
|
||||
Note: Defers to the vector constructor above.
|
||||
After creating the template fields cannot be
|
||||
added, modified, or removed.
|
||||
*/
|
||||
SOTemplate(
|
||||
std::initializer_list<SOElement> uniqueFields,
|
||||
|
||||
@@ -42,8 +42,8 @@ private:
|
||||
public:
|
||||
using value_type = STAmount;
|
||||
|
||||
static int const cMinOffset = -96;
|
||||
static int const cMaxOffset = 80;
|
||||
static int constexpr cMinOffset = -96;
|
||||
static int constexpr cMaxOffset = 80;
|
||||
|
||||
// Maximum native value supported by the code
|
||||
constexpr static std::uint64_t cMinValue = 1'000'000'000'000'000ull;
|
||||
@@ -739,6 +739,21 @@ canAdd(STAmount const& amt1, STAmount const& amt2);
|
||||
bool
|
||||
canSubtract(STAmount const& amt1, STAmount const& amt2);
|
||||
|
||||
/** Get the scale of a Number for a given asset.
|
||||
*
|
||||
* "scale" is similar to "exponent", but from the perspective of STAmount, which has different rules
|
||||
* and mantissa ranges for determining the exponent than Number.
|
||||
*
|
||||
* @param number The Number to get the scale of.
|
||||
* @param asset The asset to use for determining the scale.
|
||||
* @return The scale of this Number for the given asset.
|
||||
*/
|
||||
inline int
|
||||
scale(Number const& number, Asset const& asset)
|
||||
{
|
||||
return STAmount{asset, number}.exponent();
|
||||
}
|
||||
|
||||
} // namespace xrpl
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
@@ -3,444 +3,294 @@
|
||||
#include <xrpl/protocol/LedgerFormats.h>
|
||||
|
||||
#include <cstdint>
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
namespace xrpl {
|
||||
|
||||
/** Transaction flags.
|
||||
|
||||
These flags are specified in a transaction's 'Flags' field and modify
|
||||
the behavior of that transaction.
|
||||
These flags are specified in a transaction's 'Flags' field and modify the
|
||||
behavior of that transaction.
|
||||
|
||||
There are two types of flags:
|
||||
|
||||
(1) Universal flags: these are flags which apply to, and are interpreted the same way by,
|
||||
all transactions, except, perhaps, to special pseudo-transactions.
|
||||
(1) Universal flags: these are flags which apply to, and are interpreted
|
||||
the same way by, all transactions, except, perhaps,
|
||||
to special pseudo-transactions.
|
||||
|
||||
(2) Tx-Specific flags: these are flags which are interpreted according to the type of the
|
||||
transaction being executed. That is, the same numerical flag value may have different
|
||||
effects, depending on the transaction being executed.
|
||||
(2) Tx-Specific flags: these are flags which are interpreted according
|
||||
to the type of the transaction being executed.
|
||||
That is, the same numerical flag value may have
|
||||
different effects, depending on the transaction
|
||||
being executed.
|
||||
|
||||
@note The universal transaction flags occupy the high-order 8 bits.
|
||||
The tx-specific flags occupy the remaining 24 bits.
|
||||
@note The universal transaction flags occupy the high-order 8 bits. The
|
||||
tx-specific flags occupy the remaining 24 bits.
|
||||
|
||||
@warning Transaction flags form part of the protocol.
|
||||
**Changing them should be avoided because without special handling, this will result in
|
||||
a hard fork.**
|
||||
@warning Transaction flags form part of the protocol. **Changing them
|
||||
should be avoided because without special handling, this will
|
||||
result in a hard fork.**
|
||||
|
||||
@ingroup protocol
|
||||
*/
|
||||
|
||||
using FlagValue = std::uint32_t;
|
||||
|
||||
// Universal Transaction flags:
|
||||
inline constexpr FlagValue tfFullyCanonicalSig = 0x80000000;
|
||||
inline constexpr FlagValue tfInnerBatchTxn = 0x40000000;
|
||||
inline constexpr FlagValue tfUniversal = tfFullyCanonicalSig | tfInnerBatchTxn;
|
||||
inline constexpr FlagValue tfUniversalMask = ~tfUniversal;
|
||||
|
||||
#pragma push_macro("XMACRO")
|
||||
#pragma push_macro("TO_VALUE")
|
||||
#pragma push_macro("VALUE_TO_MAP")
|
||||
#pragma push_macro("NULL_NAME")
|
||||
#pragma push_macro("NULL_OUTPUT")
|
||||
#pragma push_macro("TO_MAP")
|
||||
#pragma push_macro("TO_MASK")
|
||||
#pragma push_macro("VALUE_TO_MASK")
|
||||
#pragma push_macro("ALL_TX_FLAGS")
|
||||
#pragma push_macro("NULL_MASK_ADJ")
|
||||
#pragma push_macro("MASK_ADJ_TO_MASK")
|
||||
|
||||
#undef XMACRO
|
||||
#undef TO_VALUE
|
||||
#undef VALUE_TO_MAP
|
||||
#undef NULL_NAME
|
||||
#undef NULL_OUTPUT
|
||||
#undef TO_MAP
|
||||
#undef TO_MASK
|
||||
#undef VALUE_TO_MASK
|
||||
#undef NULL_MASK_ADJ
|
||||
#undef MASK_ADJ_TO_MASK
|
||||
|
||||
// Formatting equals sign aligned 4 spaces after longest prefix, except for
|
||||
// wrapped lines
|
||||
// clang-format off
|
||||
#undef ALL_TX_FLAGS
|
||||
// Universal Transaction flags:
|
||||
constexpr std::uint32_t tfFullyCanonicalSig = 0x80000000;
|
||||
constexpr std::uint32_t tfInnerBatchTxn = 0x40000000;
|
||||
constexpr std::uint32_t tfUniversal = tfFullyCanonicalSig | tfInnerBatchTxn;
|
||||
constexpr std::uint32_t tfUniversalMask = ~tfUniversal;
|
||||
|
||||
// XMACRO parameters:
|
||||
// - TRANSACTION: handles the transaction name, its flags, and mask adjustment
|
||||
// - TF_FLAG: defines a new flag constant
|
||||
// - TF_FLAG2: references an existing flag constant (no new definition)
|
||||
// - MASK_ADJ: specifies flags to add back to the mask (making them invalid for this tx type)
|
||||
//
|
||||
// Note: MASK_ADJ is used when a universal flag should be invalid for a specific transaction.
|
||||
// For example, Batch uses MASK_ADJ(tfInnerBatchTxn) because the outer Batch transaction
|
||||
// must not have tfInnerBatchTxn set (only inner transactions should have it).
|
||||
//
|
||||
// TODO: Consider rewriting this using reflection in C++26 or later. Alternatively this could be a DSL processed by a script at build time.
|
||||
#define XMACRO(TRANSACTION, TF_FLAG, TF_FLAG2, MASK_ADJ) \
|
||||
TRANSACTION(AccountSet, \
|
||||
TF_FLAG(tfRequireDestTag, 0x00010000) \
|
||||
TF_FLAG(tfOptionalDestTag, 0x00020000) \
|
||||
TF_FLAG(tfRequireAuth, 0x00040000) \
|
||||
TF_FLAG(tfOptionalAuth, 0x00080000) \
|
||||
TF_FLAG(tfDisallowXRP, 0x00100000) \
|
||||
TF_FLAG(tfAllowXRP, 0x00200000), \
|
||||
MASK_ADJ(0)) \
|
||||
\
|
||||
TRANSACTION(OfferCreate, \
|
||||
TF_FLAG(tfPassive, 0x00010000) \
|
||||
TF_FLAG(tfImmediateOrCancel, 0x00020000) \
|
||||
TF_FLAG(tfFillOrKill, 0x00040000) \
|
||||
TF_FLAG(tfSell, 0x00080000) \
|
||||
TF_FLAG(tfHybrid, 0x00100000), \
|
||||
MASK_ADJ(0)) \
|
||||
\
|
||||
TRANSACTION(Payment, \
|
||||
TF_FLAG(tfNoRippleDirect, 0x00010000) \
|
||||
TF_FLAG(tfPartialPayment, 0x00020000) \
|
||||
TF_FLAG(tfLimitQuality, 0x00040000), \
|
||||
MASK_ADJ(0)) \
|
||||
\
|
||||
TRANSACTION(TrustSet, \
|
||||
TF_FLAG(tfSetfAuth, 0x00010000) \
|
||||
TF_FLAG(tfSetNoRipple, 0x00020000) \
|
||||
TF_FLAG(tfClearNoRipple, 0x00040000) \
|
||||
TF_FLAG(tfSetFreeze, 0x00100000) \
|
||||
TF_FLAG(tfClearFreeze, 0x00200000) \
|
||||
TF_FLAG(tfSetDeepFreeze, 0x00400000) \
|
||||
TF_FLAG(tfClearDeepFreeze, 0x00800000), \
|
||||
MASK_ADJ(0)) \
|
||||
\
|
||||
TRANSACTION(EnableAmendment, \
|
||||
TF_FLAG(tfGotMajority, 0x00010000) \
|
||||
TF_FLAG(tfLostMajority, 0x00020000), \
|
||||
MASK_ADJ(0)) \
|
||||
\
|
||||
TRANSACTION(PaymentChannelClaim, \
|
||||
TF_FLAG(tfRenew, 0x00010000) \
|
||||
TF_FLAG(tfClose, 0x00020000), \
|
||||
MASK_ADJ(0)) \
|
||||
\
|
||||
TRANSACTION(NFTokenMint, \
|
||||
TF_FLAG(tfBurnable, 0x00000001) \
|
||||
TF_FLAG(tfOnlyXRP, 0x00000002) \
|
||||
/* deprecated TF_FLAG(tfTrustLine, 0x00000004) */ \
|
||||
TF_FLAG(tfTransferable, 0x00000008) \
|
||||
TF_FLAG(tfMutable, 0x00000010), \
|
||||
MASK_ADJ(0)) \
|
||||
\
|
||||
TRANSACTION(MPTokenIssuanceCreate, \
|
||||
/* Note: tf/lsfMPTLocked is intentionally omitted since this transaction is not allowed to modify it. */ \
|
||||
TF_FLAG(tfMPTCanLock, lsfMPTCanLock) \
|
||||
TF_FLAG(tfMPTRequireAuth, lsfMPTRequireAuth) \
|
||||
TF_FLAG(tfMPTCanEscrow, lsfMPTCanEscrow) \
|
||||
TF_FLAG(tfMPTCanTrade, lsfMPTCanTrade) \
|
||||
TF_FLAG(tfMPTCanTransfer, lsfMPTCanTransfer) \
|
||||
TF_FLAG(tfMPTCanClawback, lsfMPTCanClawback), \
|
||||
MASK_ADJ(0)) \
|
||||
\
|
||||
TRANSACTION(MPTokenAuthorize, \
|
||||
TF_FLAG(tfMPTUnauthorize, 0x00000001), \
|
||||
MASK_ADJ(0)) \
|
||||
\
|
||||
TRANSACTION(MPTokenIssuanceSet, \
|
||||
TF_FLAG(tfMPTLock, 0x00000001) \
|
||||
TF_FLAG(tfMPTUnlock, 0x00000002), \
|
||||
MASK_ADJ(0)) \
|
||||
\
|
||||
TRANSACTION(NFTokenCreateOffer, \
|
||||
TF_FLAG(tfSellNFToken, 0x00000001), \
|
||||
MASK_ADJ(0)) \
|
||||
\
|
||||
TRANSACTION(AMMDeposit, \
|
||||
TF_FLAG(tfLPToken, 0x00010000) \
|
||||
TF_FLAG(tfSingleAsset, 0x00080000) \
|
||||
TF_FLAG(tfTwoAsset, 0x00100000) \
|
||||
TF_FLAG(tfOneAssetLPToken, 0x00200000) \
|
||||
TF_FLAG(tfLimitLPToken, 0x00400000) \
|
||||
TF_FLAG(tfTwoAssetIfEmpty, 0x00800000), \
|
||||
MASK_ADJ(0)) \
|
||||
\
|
||||
TRANSACTION(AMMWithdraw, \
|
||||
TF_FLAG2(tfLPToken, 0x00010000) \
|
||||
TF_FLAG(tfWithdrawAll, 0x00020000) \
|
||||
TF_FLAG(tfOneAssetWithdrawAll, 0x00040000) \
|
||||
TF_FLAG2(tfSingleAsset, 0x00080000) \
|
||||
TF_FLAG2(tfTwoAsset, 0x00100000) \
|
||||
TF_FLAG2(tfOneAssetLPToken, 0x00200000) \
|
||||
TF_FLAG2(tfLimitLPToken, 0x00400000), \
|
||||
MASK_ADJ(0)) \
|
||||
\
|
||||
TRANSACTION(AMMClawback, \
|
||||
TF_FLAG(tfClawTwoAssets, 0x00000001), \
|
||||
MASK_ADJ(0)) \
|
||||
\
|
||||
TRANSACTION(XChainModifyBridge, \
|
||||
TF_FLAG(tfClearAccountCreateAmount, 0x00010000), \
|
||||
MASK_ADJ(0)) \
|
||||
\
|
||||
TRANSACTION(VaultCreate, \
|
||||
TF_FLAG(tfVaultPrivate, lsfVaultPrivate) \
|
||||
TF_FLAG(tfVaultShareNonTransferable, 0x00020000), \
|
||||
MASK_ADJ(0)) \
|
||||
\
|
||||
TRANSACTION(Batch, \
|
||||
TF_FLAG(tfAllOrNothing, 0x00010000) \
|
||||
TF_FLAG(tfOnlyOne, 0x00020000) \
|
||||
TF_FLAG(tfUntilFailure, 0x00040000) \
|
||||
TF_FLAG(tfIndependent, 0x00080000), \
|
||||
MASK_ADJ(tfInnerBatchTxn)) /* Batch must reject tfInnerBatchTxn - only inner transactions should have this flag */ \
|
||||
\
|
||||
TRANSACTION(LoanSet, /* True indicates the loan supports overpayments */ \
|
||||
TF_FLAG(tfLoanOverpayment, 0x00010000), \
|
||||
MASK_ADJ(0)) \
|
||||
\
|
||||
TRANSACTION(LoanPay, /* True indicates any excess in this payment can be used as an overpayment. */ \
|
||||
/* False: no overpayments will be taken. */ \
|
||||
TF_FLAG2(tfLoanOverpayment, 0x00010000) \
|
||||
TF_FLAG(tfLoanFullPayment, 0x00020000) /* True indicates that the payment is an early full payment. */ \
|
||||
/* It must pay the entire loan including close interest and fees, or it will fail. */ \
|
||||
/* False: Not a full payment. */ \
|
||||
TF_FLAG(tfLoanLatePayment, 0x00040000), /* True indicates that the payment is late, and includes late interest and fees. */ \
|
||||
/* If the loan is not late, it will fail. */ \
|
||||
/* False: not a late payment. If the current payment is overdue, the transaction will fail.*/ \
|
||||
MASK_ADJ(0)) \
|
||||
\
|
||||
TRANSACTION(LoanManage, \
|
||||
TF_FLAG(tfLoanDefault, 0x00010000) \
|
||||
TF_FLAG(tfLoanImpair, 0x00020000) \
|
||||
TF_FLAG(tfLoanUnimpair, 0x00040000), \
|
||||
MASK_ADJ(0))
|
||||
// AccountSet flags:
|
||||
constexpr std::uint32_t tfRequireDestTag = 0x00010000;
|
||||
constexpr std::uint32_t tfOptionalDestTag = 0x00020000;
|
||||
constexpr std::uint32_t tfRequireAuth = 0x00040000;
|
||||
constexpr std::uint32_t tfOptionalAuth = 0x00080000;
|
||||
constexpr std::uint32_t tfDisallowXRP = 0x00100000;
|
||||
constexpr std::uint32_t tfAllowXRP = 0x00200000;
|
||||
constexpr std::uint32_t tfAccountSetMask =
|
||||
~(tfUniversal | tfRequireDestTag | tfOptionalDestTag | tfRequireAuth |
|
||||
tfOptionalAuth | tfDisallowXRP | tfAllowXRP);
|
||||
|
||||
// clang-format on
|
||||
// AccountSet SetFlag/ClearFlag values
|
||||
constexpr std::uint32_t asfRequireDest = 1;
|
||||
constexpr std::uint32_t asfRequireAuth = 2;
|
||||
constexpr std::uint32_t asfDisallowXRP = 3;
|
||||
constexpr std::uint32_t asfDisableMaster = 4;
|
||||
constexpr std::uint32_t asfAccountTxnID = 5;
|
||||
constexpr std::uint32_t asfNoFreeze = 6;
|
||||
constexpr std::uint32_t asfGlobalFreeze = 7;
|
||||
constexpr std::uint32_t asfDefaultRipple = 8;
|
||||
constexpr std::uint32_t asfDepositAuth = 9;
|
||||
constexpr std::uint32_t asfAuthorizedNFTokenMinter = 10;
|
||||
/* // reserved for Hooks amendment
|
||||
constexpr std::uint32_t asfTshCollect = 11;
|
||||
*/
|
||||
constexpr std::uint32_t asfDisallowIncomingNFTokenOffer = 12;
|
||||
constexpr std::uint32_t asfDisallowIncomingCheck = 13;
|
||||
constexpr std::uint32_t asfDisallowIncomingPayChan = 14;
|
||||
constexpr std::uint32_t asfDisallowIncomingTrustline = 15;
|
||||
constexpr std::uint32_t asfAllowTrustLineClawback = 16;
|
||||
constexpr std::uint32_t asfAllowTrustLineLocking = 17;
|
||||
|
||||
// Create all the flag values.
|
||||
//
|
||||
// example:
|
||||
// inline constexpr FlagValue tfAccountSetRequireDestTag = 0x00010000;
|
||||
#define TO_VALUE(name, value) inline constexpr FlagValue name = value;
|
||||
#define NULL_NAME(name, values, maskAdj) values
|
||||
#define NULL_OUTPUT(name, value)
|
||||
#define NULL_MASK_ADJ(value)
|
||||
XMACRO(NULL_NAME, TO_VALUE, NULL_OUTPUT, NULL_MASK_ADJ)
|
||||
// OfferCreate flags:
|
||||
constexpr std::uint32_t tfPassive = 0x00010000;
|
||||
constexpr std::uint32_t tfImmediateOrCancel = 0x00020000;
|
||||
constexpr std::uint32_t tfFillOrKill = 0x00040000;
|
||||
constexpr std::uint32_t tfSell = 0x00080000;
|
||||
constexpr std::uint32_t tfHybrid = 0x00100000;
|
||||
constexpr std::uint32_t tfOfferCreateMask =
|
||||
~(tfUniversal | tfPassive | tfImmediateOrCancel | tfFillOrKill | tfSell | tfHybrid);
|
||||
|
||||
// Create masks for each transaction type that has flags.
|
||||
//
|
||||
// example:
|
||||
// inline constexpr FlagValue tfAccountSetMask = ~(tfUniversal | tfRequireDestTag |
|
||||
// tfOptionalDestTag | tfRequireAuth | tfOptionalAuth | tfDisallowXRP | tfAllowXRP);
|
||||
//
|
||||
// The mask adjustment (maskAdj) allows adding flags back to the mask, making them invalid.
|
||||
// For example, Batch uses MASK_ADJ(tfInnerBatchTxn) to reject tfInnerBatchTxn on outer Batch.
|
||||
#define TO_MASK(name, values, maskAdj) \
|
||||
inline constexpr FlagValue tf##name##Mask = ~(tfUniversal values) | maskAdj;
|
||||
#define VALUE_TO_MASK(name, value) | name
|
||||
#define MASK_ADJ_TO_MASK(value) value
|
||||
XMACRO(TO_MASK, VALUE_TO_MASK, VALUE_TO_MASK, MASK_ADJ_TO_MASK)
|
||||
// Payment flags:
|
||||
constexpr std::uint32_t tfNoRippleDirect = 0x00010000;
|
||||
constexpr std::uint32_t tfPartialPayment = 0x00020000;
|
||||
constexpr std::uint32_t tfLimitQuality = 0x00040000;
|
||||
constexpr std::uint32_t tfPaymentMask =
|
||||
~(tfUniversal | tfPartialPayment | tfLimitQuality | tfNoRippleDirect);
|
||||
constexpr std::uint32_t tfMPTPaymentMask = ~(tfUniversal | tfPartialPayment);
|
||||
|
||||
// Verify that tfBatchMask correctly rejects tfInnerBatchTxn.
|
||||
// The outer Batch transaction must NOT have tfInnerBatchTxn set; only inner transactions should
|
||||
// have it.
|
||||
static_assert(
|
||||
(tfBatchMask & tfInnerBatchTxn) == tfInnerBatchTxn,
|
||||
"tfBatchMask must include tfInnerBatchTxn to reject it on outer Batch");
|
||||
// TrustSet flags:
|
||||
constexpr std::uint32_t tfSetfAuth = 0x00010000;
|
||||
constexpr std::uint32_t tfSetNoRipple = 0x00020000;
|
||||
constexpr std::uint32_t tfClearNoRipple = 0x00040000;
|
||||
constexpr std::uint32_t tfSetFreeze = 0x00100000;
|
||||
constexpr std::uint32_t tfClearFreeze = 0x00200000;
|
||||
constexpr std::uint32_t tfSetDeepFreeze = 0x00400000;
|
||||
constexpr std::uint32_t tfClearDeepFreeze = 0x00800000;
|
||||
constexpr std::uint32_t tfTrustSetMask =
|
||||
~(tfUniversal | tfSetfAuth | tfSetNoRipple | tfClearNoRipple | tfSetFreeze |
|
||||
tfClearFreeze | tfSetDeepFreeze | tfClearDeepFreeze);
|
||||
constexpr std::uint32_t tfTrustSetPermissionMask = ~(tfUniversal | tfSetfAuth | tfSetFreeze | tfClearFreeze);
|
||||
|
||||
// Verify that other transaction masks correctly allow tfInnerBatchTxn.
|
||||
// Inner transactions need tfInnerBatchTxn to be valid, so these masks must not reject it.
|
||||
static_assert(
|
||||
(tfPaymentMask & tfInnerBatchTxn) == 0,
|
||||
"tfPaymentMask must not reject tfInnerBatchTxn");
|
||||
static_assert(
|
||||
(tfAccountSetMask & tfInnerBatchTxn) == 0,
|
||||
"tfAccountSetMask must not reject tfInnerBatchTxn");
|
||||
// EnableAmendment flags:
|
||||
constexpr std::uint32_t tfGotMajority = 0x00010000;
|
||||
constexpr std::uint32_t tfLostMajority = 0x00020000;
|
||||
constexpr std::uint32_t tfChangeMask =
|
||||
~( tfUniversal | tfGotMajority | tfLostMajority);
|
||||
|
||||
// Create getter functions for each set of flags using Meyer's singleton pattern.
|
||||
// This avoids static initialization order fiasco while still providing efficient access.
|
||||
// This is used below in `getAllTxFlags()` to generate the server_definitions RPC
|
||||
// output.
|
||||
//
|
||||
// example:
|
||||
// inline FlagMap const& getAccountSetFlags() {
|
||||
// static FlagMap const flags = {
|
||||
// {"tfRequireDestTag", 0x00010000},
|
||||
// {"tfOptionalDestTag", 0x00020000},
|
||||
// ...};
|
||||
// return flags;
|
||||
// }
|
||||
using FlagMap = std::map<std::string, FlagValue>;
|
||||
#define VALUE_TO_MAP(name, value) {#name, value},
|
||||
#define TO_MAP(name, values, maskAdj) \
|
||||
inline FlagMap const& get##name##Flags() \
|
||||
{ \
|
||||
static FlagMap const flags = {values}; \
|
||||
return flags; \
|
||||
}
|
||||
XMACRO(TO_MAP, VALUE_TO_MAP, VALUE_TO_MAP, NULL_MASK_ADJ)
|
||||
// PaymentChannelClaim flags:
|
||||
constexpr std::uint32_t tfRenew = 0x00010000;
|
||||
constexpr std::uint32_t tfClose = 0x00020000;
|
||||
constexpr std::uint32_t tfPayChanClaimMask = ~(tfUniversal | tfRenew | tfClose);
|
||||
|
||||
inline FlagMap const&
|
||||
getUniversalFlags()
|
||||
{
|
||||
static FlagMap const flags = {
|
||||
{"tfFullyCanonicalSig", tfFullyCanonicalSig}, {"tfInnerBatchTxn", tfInnerBatchTxn}};
|
||||
return flags;
|
||||
}
|
||||
// NFTokenMint flags:
|
||||
constexpr std::uint32_t const tfBurnable = 0x00000001;
|
||||
constexpr std::uint32_t const tfOnlyXRP = 0x00000002;
|
||||
constexpr std::uint32_t const tfTrustLine = 0x00000004;
|
||||
constexpr std::uint32_t const tfTransferable = 0x00000008;
|
||||
constexpr std::uint32_t const tfMutable = 0x00000010;
|
||||
|
||||
// Create a getter function for all transaction flag maps using Meyer's singleton pattern.
|
||||
// This is used to generate the server_definitions RPC output.
|
||||
//
|
||||
// example:
|
||||
// inline FlagMapPairList const& getAllTxFlags() {
|
||||
// static FlagMapPairList const flags = {
|
||||
// {"AccountSet", getAccountSetFlags()},
|
||||
// ...};
|
||||
// return flags;
|
||||
// }
|
||||
using FlagMapPairList = std::vector<std::pair<std::string, FlagMap>>;
|
||||
#define ALL_TX_FLAGS(name, values, maskAdj) {#name, get##name##Flags()},
|
||||
inline FlagMapPairList const&
|
||||
getAllTxFlags()
|
||||
{
|
||||
static FlagMapPairList const flags = {
|
||||
{"universal", getUniversalFlags()},
|
||||
XMACRO(ALL_TX_FLAGS, NULL_OUTPUT, NULL_OUTPUT, NULL_MASK_ADJ)};
|
||||
return flags;
|
||||
}
|
||||
|
||||
#undef XMACRO
|
||||
#undef TO_VALUE
|
||||
#undef VALUE_TO_MAP
|
||||
#undef NULL_NAME
|
||||
#undef NULL_OUTPUT
|
||||
#undef TO_MAP
|
||||
#undef TO_MASK
|
||||
#undef VALUE_TO_MASK
|
||||
#undef ALL_TX_FLAGS
|
||||
#undef NULL_MASK_ADJ
|
||||
#undef MASK_ADJ_TO_MASK
|
||||
|
||||
#pragma pop_macro("XMACRO")
|
||||
#pragma pop_macro("TO_VALUE")
|
||||
#pragma pop_macro("VALUE_TO_MAP")
|
||||
#pragma pop_macro("NULL_NAME")
|
||||
#pragma pop_macro("NULL_OUTPUT")
|
||||
#pragma pop_macro("TO_MAP")
|
||||
#pragma pop_macro("TO_MASK")
|
||||
#pragma pop_macro("VALUE_TO_MASK")
|
||||
#pragma pop_macro("ALL_TX_FLAGS")
|
||||
#pragma pop_macro("NULL_MASK_ADJ")
|
||||
#pragma pop_macro("MASK_ADJ_TO_MASK")
|
||||
|
||||
// Additional transaction masks and combos
|
||||
inline constexpr FlagValue tfMPTPaymentMask = ~(tfUniversal | tfPartialPayment);
|
||||
inline constexpr FlagValue tfTrustSetPermissionMask =
|
||||
~(tfUniversal | tfSetfAuth | tfSetFreeze | tfClearFreeze);
|
||||
// MPTokenIssuanceCreate flags:
|
||||
// Note: tf/lsfMPTLocked is intentionally omitted, since this transaction
|
||||
// is not allowed to modify it.
|
||||
constexpr std::uint32_t const tfMPTCanLock = lsfMPTCanLock;
|
||||
constexpr std::uint32_t const tfMPTRequireAuth = lsfMPTRequireAuth;
|
||||
constexpr std::uint32_t const tfMPTCanEscrow = lsfMPTCanEscrow;
|
||||
constexpr std::uint32_t const tfMPTCanTrade = lsfMPTCanTrade;
|
||||
constexpr std::uint32_t const tfMPTCanTransfer = lsfMPTCanTransfer;
|
||||
constexpr std::uint32_t const tfMPTCanClawback = lsfMPTCanClawback;
|
||||
constexpr std::uint32_t const tfMPTokenIssuanceCreateMask =
|
||||
~(tfUniversal | tfMPTCanLock | tfMPTRequireAuth | tfMPTCanEscrow | tfMPTCanTrade | tfMPTCanTransfer | tfMPTCanClawback);
|
||||
|
||||
// MPTokenIssuanceCreate MutableFlags:
|
||||
// Indicating specific fields or flags may be changed after issuance.
|
||||
inline constexpr FlagValue tmfMPTCanMutateCanLock = lsmfMPTCanMutateCanLock;
|
||||
inline constexpr FlagValue tmfMPTCanMutateRequireAuth = lsmfMPTCanMutateRequireAuth;
|
||||
inline constexpr FlagValue tmfMPTCanMutateCanEscrow = lsmfMPTCanMutateCanEscrow;
|
||||
inline constexpr FlagValue tmfMPTCanMutateCanTrade = lsmfMPTCanMutateCanTrade;
|
||||
inline constexpr FlagValue tmfMPTCanMutateCanTransfer = lsmfMPTCanMutateCanTransfer;
|
||||
inline constexpr FlagValue tmfMPTCanMutateCanClawback = lsmfMPTCanMutateCanClawback;
|
||||
inline constexpr FlagValue tmfMPTCanMutateMetadata = lsmfMPTCanMutateMetadata;
|
||||
inline constexpr FlagValue tmfMPTCanMutateTransferFee = lsmfMPTCanMutateTransferFee;
|
||||
inline constexpr FlagValue tmfMPTokenIssuanceCreateMutableMask =
|
||||
~(tmfMPTCanMutateCanLock | tmfMPTCanMutateRequireAuth | tmfMPTCanMutateCanEscrow |
|
||||
tmfMPTCanMutateCanTrade | tmfMPTCanMutateCanTransfer | tmfMPTCanMutateCanClawback |
|
||||
tmfMPTCanMutateMetadata | tmfMPTCanMutateTransferFee);
|
||||
constexpr std::uint32_t const tmfMPTCanMutateCanLock = lsmfMPTCanMutateCanLock;
|
||||
constexpr std::uint32_t const tmfMPTCanMutateRequireAuth = lsmfMPTCanMutateRequireAuth;
|
||||
constexpr std::uint32_t const tmfMPTCanMutateCanEscrow = lsmfMPTCanMutateCanEscrow;
|
||||
constexpr std::uint32_t const tmfMPTCanMutateCanTrade = lsmfMPTCanMutateCanTrade;
|
||||
constexpr std::uint32_t const tmfMPTCanMutateCanTransfer = lsmfMPTCanMutateCanTransfer;
|
||||
constexpr std::uint32_t const tmfMPTCanMutateCanClawback = lsmfMPTCanMutateCanClawback;
|
||||
constexpr std::uint32_t const tmfMPTCanMutateMetadata = lsmfMPTCanMutateMetadata;
|
||||
constexpr std::uint32_t const tmfMPTCanMutateTransferFee = lsmfMPTCanMutateTransferFee;
|
||||
constexpr std::uint32_t const tmfMPTokenIssuanceCreateMutableMask =
|
||||
~(tmfMPTCanMutateCanLock | tmfMPTCanMutateRequireAuth | tmfMPTCanMutateCanEscrow | tmfMPTCanMutateCanTrade
|
||||
| tmfMPTCanMutateCanTransfer | tmfMPTCanMutateCanClawback | tmfMPTCanMutateMetadata | tmfMPTCanMutateTransferFee);
|
||||
|
||||
// MPTokenAuthorize flags:
|
||||
constexpr std::uint32_t const tfMPTUnauthorize = 0x00000001;
|
||||
constexpr std::uint32_t const tfMPTokenAuthorizeMask = ~(tfUniversal | tfMPTUnauthorize);
|
||||
|
||||
// MPTokenIssuanceSet flags:
|
||||
constexpr std::uint32_t const tfMPTLock = 0x00000001;
|
||||
constexpr std::uint32_t const tfMPTUnlock = 0x00000002;
|
||||
constexpr std::uint32_t const tfMPTokenIssuanceSetMask = ~(tfUniversal | tfMPTLock | tfMPTUnlock);
|
||||
constexpr std::uint32_t const tfMPTokenIssuanceSetPermissionMask = ~(tfUniversal | tfMPTLock | tfMPTUnlock);
|
||||
|
||||
// MPTokenIssuanceSet MutableFlags:
|
||||
// Set or Clear flags.
|
||||
constexpr std::uint32_t const tmfMPTSetCanLock = 0x00000001;
|
||||
constexpr std::uint32_t const tmfMPTClearCanLock = 0x00000002;
|
||||
constexpr std::uint32_t const tmfMPTSetRequireAuth = 0x00000004;
|
||||
constexpr std::uint32_t const tmfMPTClearRequireAuth = 0x00000008;
|
||||
constexpr std::uint32_t const tmfMPTSetCanEscrow = 0x00000010;
|
||||
constexpr std::uint32_t const tmfMPTClearCanEscrow = 0x00000020;
|
||||
constexpr std::uint32_t const tmfMPTSetCanTrade = 0x00000040;
|
||||
constexpr std::uint32_t const tmfMPTClearCanTrade = 0x00000080;
|
||||
constexpr std::uint32_t const tmfMPTSetCanTransfer = 0x00000100;
|
||||
constexpr std::uint32_t const tmfMPTClearCanTransfer = 0x00000200;
|
||||
constexpr std::uint32_t const tmfMPTSetCanClawback = 0x00000400;
|
||||
constexpr std::uint32_t const tmfMPTClearCanClawback = 0x00000800;
|
||||
constexpr std::uint32_t const tmfMPTokenIssuanceSetMutableMask = ~(tmfMPTSetCanLock | tmfMPTClearCanLock |
|
||||
tmfMPTSetRequireAuth | tmfMPTClearRequireAuth | tmfMPTSetCanEscrow | tmfMPTClearCanEscrow |
|
||||
tmfMPTSetCanTrade | tmfMPTClearCanTrade | tmfMPTSetCanTransfer | tmfMPTClearCanTransfer |
|
||||
tmfMPTSetCanClawback | tmfMPTClearCanClawback);
|
||||
|
||||
inline constexpr FlagValue tmfMPTSetCanLock = 0x00000001;
|
||||
inline constexpr FlagValue tmfMPTClearCanLock = 0x00000002;
|
||||
inline constexpr FlagValue tmfMPTSetRequireAuth = 0x00000004;
|
||||
inline constexpr FlagValue tmfMPTClearRequireAuth = 0x00000008;
|
||||
inline constexpr FlagValue tmfMPTSetCanEscrow = 0x00000010;
|
||||
inline constexpr FlagValue tmfMPTClearCanEscrow = 0x00000020;
|
||||
inline constexpr FlagValue tmfMPTSetCanTrade = 0x00000040;
|
||||
inline constexpr FlagValue tmfMPTClearCanTrade = 0x00000080;
|
||||
inline constexpr FlagValue tmfMPTSetCanTransfer = 0x00000100;
|
||||
inline constexpr FlagValue tmfMPTClearCanTransfer = 0x00000200;
|
||||
inline constexpr FlagValue tmfMPTSetCanClawback = 0x00000400;
|
||||
inline constexpr FlagValue tmfMPTClearCanClawback = 0x00000800;
|
||||
inline constexpr FlagValue tmfMPTokenIssuanceSetMutableMask = ~(
|
||||
tmfMPTSetCanLock | tmfMPTClearCanLock | tmfMPTSetRequireAuth | tmfMPTClearRequireAuth |
|
||||
tmfMPTSetCanEscrow | tmfMPTClearCanEscrow | tmfMPTSetCanTrade | tmfMPTClearCanTrade |
|
||||
tmfMPTSetCanTransfer | tmfMPTClearCanTransfer | tmfMPTSetCanClawback | tmfMPTClearCanClawback);
|
||||
// MPTokenIssuanceDestroy flags:
|
||||
constexpr std::uint32_t const tfMPTokenIssuanceDestroyMask = ~tfUniversal;
|
||||
|
||||
// Prior to fixRemoveNFTokenAutoTrustLine, transfer of an NFToken between accounts allowed a
|
||||
// TrustLine to be added to the issuer of that token without explicit permission from that issuer.
|
||||
// This was enabled by minting the NFToken with the tfTrustLine flag set.
|
||||
// Prior to fixRemoveNFTokenAutoTrustLine, transfer of an NFToken between
|
||||
// accounts allowed a TrustLine to be added to the issuer of that token
|
||||
// without explicit permission from that issuer. This was enabled by
|
||||
// minting the NFToken with the tfTrustLine flag set.
|
||||
//
|
||||
// That capability could be used to attack the NFToken issuer.
|
||||
// It would be possible for two accounts to trade the NFToken back and forth building up any number
|
||||
// of TrustLines on the issuer, increasing the issuer's reserve without bound.
|
||||
// That capability could be used to attack the NFToken issuer. It
|
||||
// would be possible for two accounts to trade the NFToken back and forth
|
||||
// building up any number of TrustLines on the issuer, increasing the
|
||||
// issuer's reserve without bound.
|
||||
//
|
||||
// The fixRemoveNFTokenAutoTrustLine amendment disables minting with the tfTrustLine flag as a way
|
||||
// to prevent the attack. But until the amendment passes we still need to keep the old behavior
|
||||
// available.
|
||||
inline constexpr FlagValue tfTrustLine = 0x00000004; // needed for backwards compatibility
|
||||
inline constexpr FlagValue tfNFTokenMintMaskWithoutMutable =
|
||||
// The fixRemoveNFTokenAutoTrustLine amendment disables minting with the
|
||||
// tfTrustLine flag as a way to prevent the attack. But until the
|
||||
// amendment passes we still need to keep the old behavior available.
|
||||
constexpr std::uint32_t const tfNFTokenMintMask =
|
||||
~(tfUniversal | tfBurnable | tfOnlyXRP | tfTransferable);
|
||||
|
||||
inline constexpr FlagValue tfNFTokenMintOldMask = ~(~tfNFTokenMintMaskWithoutMutable | tfTrustLine);
|
||||
constexpr std::uint32_t const tfNFTokenMintOldMask =
|
||||
~( ~tfNFTokenMintMask | tfTrustLine);
|
||||
|
||||
// if featureDynamicNFT enabled then new flag allowing mutable URI available.
|
||||
inline constexpr FlagValue tfNFTokenMintOldMaskWithMutable = ~(~tfNFTokenMintOldMask | tfMutable);
|
||||
constexpr std::uint32_t const tfNFTokenMintOldMaskWithMutable =
|
||||
~( ~tfNFTokenMintOldMask | tfMutable);
|
||||
|
||||
inline constexpr FlagValue tfWithdrawSubTx = tfLPToken | tfSingleAsset | tfTwoAsset |
|
||||
tfOneAssetLPToken | tfLimitLPToken | tfWithdrawAll | tfOneAssetWithdrawAll;
|
||||
inline constexpr FlagValue tfDepositSubTx =
|
||||
tfLPToken | tfSingleAsset | tfTwoAsset | tfOneAssetLPToken | tfLimitLPToken | tfTwoAssetIfEmpty;
|
||||
constexpr std::uint32_t const tfNFTokenMintMaskWithMutable =
|
||||
~( ~tfNFTokenMintMask | tfMutable);
|
||||
|
||||
#pragma push_macro("ACCOUNTSET_FLAGS")
|
||||
#pragma push_macro("ACCOUNTSET_FLAG_TO_VALUE")
|
||||
#pragma push_macro("ACCOUNTSET_FLAG_TO_MAP")
|
||||
// NFTokenCreateOffer flags:
|
||||
constexpr std::uint32_t const tfSellNFToken = 0x00000001;
|
||||
constexpr std::uint32_t const tfNFTokenCreateOfferMask =
|
||||
~(tfUniversal | tfSellNFToken);
|
||||
|
||||
// AccountSet SetFlag/ClearFlag values
|
||||
#define ACCOUNTSET_FLAGS(ASF_FLAG) \
|
||||
ASF_FLAG(asfRequireDest, 1) \
|
||||
ASF_FLAG(asfRequireAuth, 2) \
|
||||
ASF_FLAG(asfDisallowXRP, 3) \
|
||||
ASF_FLAG(asfDisableMaster, 4) \
|
||||
ASF_FLAG(asfAccountTxnID, 5) \
|
||||
ASF_FLAG(asfNoFreeze, 6) \
|
||||
ASF_FLAG(asfGlobalFreeze, 7) \
|
||||
ASF_FLAG(asfDefaultRipple, 8) \
|
||||
ASF_FLAG(asfDepositAuth, 9) \
|
||||
ASF_FLAG(asfAuthorizedNFTokenMinter, 10) \
|
||||
/* 11 is reserved for Hooks amendment */ \
|
||||
/* ASF_FLAG(asfTshCollect, 11) */ \
|
||||
ASF_FLAG(asfDisallowIncomingNFTokenOffer, 12) \
|
||||
ASF_FLAG(asfDisallowIncomingCheck, 13) \
|
||||
ASF_FLAG(asfDisallowIncomingPayChan, 14) \
|
||||
ASF_FLAG(asfDisallowIncomingTrustline, 15) \
|
||||
ASF_FLAG(asfAllowTrustLineClawback, 16) \
|
||||
ASF_FLAG(asfAllowTrustLineLocking, 17)
|
||||
// NFTokenCancelOffer flags:
|
||||
constexpr std::uint32_t const tfNFTokenCancelOfferMask = ~tfUniversal;
|
||||
|
||||
#define ACCOUNTSET_FLAG_TO_VALUE(name, value) inline constexpr FlagValue name = value;
|
||||
#define ACCOUNTSET_FLAG_TO_MAP(name, value) {#name, value},
|
||||
// NFTokenAcceptOffer flags:
|
||||
constexpr std::uint32_t const tfNFTokenAcceptOfferMask = ~tfUniversal;
|
||||
|
||||
ACCOUNTSET_FLAGS(ACCOUNTSET_FLAG_TO_VALUE)
|
||||
// Clawback flags:
|
||||
constexpr std::uint32_t const tfClawbackMask = ~tfUniversal;
|
||||
|
||||
inline std::map<std::string, FlagValue> const&
|
||||
getAsfFlagMap()
|
||||
{
|
||||
static std::map<std::string, FlagValue> const flags = {
|
||||
ACCOUNTSET_FLAGS(ACCOUNTSET_FLAG_TO_MAP)};
|
||||
return flags;
|
||||
}
|
||||
// AMM Flags:
|
||||
constexpr std::uint32_t tfLPToken = 0x00010000;
|
||||
constexpr std::uint32_t tfWithdrawAll = 0x00020000;
|
||||
constexpr std::uint32_t tfOneAssetWithdrawAll = 0x00040000;
|
||||
constexpr std::uint32_t tfSingleAsset = 0x00080000;
|
||||
constexpr std::uint32_t tfTwoAsset = 0x00100000;
|
||||
constexpr std::uint32_t tfOneAssetLPToken = 0x00200000;
|
||||
constexpr std::uint32_t tfLimitLPToken = 0x00400000;
|
||||
constexpr std::uint32_t tfTwoAssetIfEmpty = 0x00800000;
|
||||
constexpr std::uint32_t tfWithdrawSubTx =
|
||||
tfLPToken | tfSingleAsset | tfTwoAsset | tfOneAssetLPToken |
|
||||
tfLimitLPToken | tfWithdrawAll | tfOneAssetWithdrawAll;
|
||||
constexpr std::uint32_t tfDepositSubTx =
|
||||
tfLPToken | tfSingleAsset | tfTwoAsset | tfOneAssetLPToken |
|
||||
tfLimitLPToken | tfTwoAssetIfEmpty;
|
||||
constexpr std::uint32_t tfWithdrawMask = ~(tfUniversal | tfWithdrawSubTx);
|
||||
constexpr std::uint32_t tfDepositMask = ~(tfUniversal | tfDepositSubTx);
|
||||
|
||||
#undef ACCOUNTSET_FLAG_TO_VALUE
|
||||
#undef ACCOUNTSET_FLAG_TO_MAP
|
||||
#undef ACCOUNTSET_FLAGS
|
||||
// AMMClawback flags:
|
||||
constexpr std::uint32_t tfClawTwoAssets = 0x00000001;
|
||||
constexpr std::uint32_t tfAMMClawbackMask = ~(tfUniversal | tfClawTwoAssets);
|
||||
|
||||
#pragma pop_macro("ACCOUNTSET_FLAG_TO_VALUE")
|
||||
#pragma pop_macro("ACCOUNTSET_FLAG_TO_MAP")
|
||||
#pragma pop_macro("ACCOUNTSET_FLAGS")
|
||||
// BridgeModify flags:
|
||||
constexpr std::uint32_t tfClearAccountCreateAmount = 0x00010000;
|
||||
constexpr std::uint32_t tfBridgeModifyMask = ~(tfUniversal | tfClearAccountCreateAmount);
|
||||
|
||||
// VaultCreate flags:
|
||||
constexpr std::uint32_t const tfVaultPrivate = 0x00010000;
|
||||
static_assert(tfVaultPrivate == lsfVaultPrivate);
|
||||
constexpr std::uint32_t const tfVaultShareNonTransferable = 0x00020000;
|
||||
constexpr std::uint32_t const tfVaultCreateMask = ~(tfUniversal | tfVaultPrivate | tfVaultShareNonTransferable);
|
||||
|
||||
// Batch Flags:
|
||||
constexpr std::uint32_t tfAllOrNothing = 0x00010000;
|
||||
constexpr std::uint32_t tfOnlyOne = 0x00020000;
|
||||
constexpr std::uint32_t tfUntilFailure = 0x00040000;
|
||||
constexpr std::uint32_t tfIndependent = 0x00080000;
|
||||
/**
|
||||
* @note If nested Batch transactions are supported in the future, the tfInnerBatchTxn flag
|
||||
* will need to be removed from this mask to allow Batch transaction to be inside
|
||||
* the sfRawTransactions array.
|
||||
*/
|
||||
constexpr std::uint32_t const tfBatchMask =
|
||||
~(tfUniversal | tfAllOrNothing | tfOnlyOne | tfUntilFailure | tfIndependent) | tfInnerBatchTxn;
|
||||
|
||||
// LoanSet and LoanPay flags:
|
||||
// LoanSet: True, indicates the loan supports overpayments
|
||||
// LoanPay: True, indicates any excess in this payment can be used
|
||||
// as an overpayment. False, no overpayments will be taken.
|
||||
constexpr std::uint32_t const tfLoanOverpayment = 0x00010000;
|
||||
// LoanPay exclusive flags:
|
||||
// tfLoanFullPayment: True, indicates that the payment is an early
|
||||
// full payment. It must pay the entire loan including close
|
||||
// interest and fees, or it will fail. False: Not a full payment.
|
||||
constexpr std::uint32_t const tfLoanFullPayment = 0x00020000;
|
||||
// tfLoanLatePayment: True, indicates that the payment is late,
|
||||
// and includes late interest and fees. If the loan is not late,
|
||||
// it will fail. False: not a late payment. If the current payment
|
||||
// is overdue, the transaction will fail.
|
||||
constexpr std::uint32_t const tfLoanLatePayment = 0x00040000;
|
||||
constexpr std::uint32_t const tfLoanSetMask = ~(tfUniversal |
|
||||
tfLoanOverpayment);
|
||||
constexpr std::uint32_t const tfLoanPayMask = ~(tfUniversal |
|
||||
tfLoanOverpayment | tfLoanFullPayment | tfLoanLatePayment);
|
||||
|
||||
// LoanManage flags:
|
||||
constexpr std::uint32_t const tfLoanDefault = 0x00010000;
|
||||
constexpr std::uint32_t const tfLoanImpair = 0x00020000;
|
||||
constexpr std::uint32_t const tfLoanUnimpair = 0x00040000;
|
||||
constexpr std::uint32_t const tfLoanManageMask = ~(tfUniversal | tfLoanDefault | tfLoanImpair | tfLoanUnimpair);
|
||||
|
||||
// clang-format on
|
||||
|
||||
} // namespace xrpl
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
|
||||
#include <xrpl/protocol/KnownFormats.h>
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace xrpl {
|
||||
|
||||
/** Transaction type identifiers.
|
||||
@@ -75,9 +73,6 @@ private:
|
||||
public:
|
||||
static TxFormats const&
|
||||
getInstance();
|
||||
|
||||
static std::vector<SOElement> const&
|
||||
getCommonFields();
|
||||
};
|
||||
|
||||
} // namespace xrpl
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
// Add new amendments to the top of this list.
|
||||
// Keep it sorted in reverse chronological order.
|
||||
|
||||
XRPL_FIX (LendingProtocolV1_1, Supported::yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FIX (PermissionedDomainInvariant, Supported::yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FIX (ExpiredNFTokenOfferRemoval, Supported::yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FIX (BatchInnerSigs, Supported::no, VoteBehavior::DefaultNo)
|
||||
|
||||
@@ -868,6 +868,7 @@ TRANSACTION(ttVAULT_DELETE, 67, VaultDelete,
|
||||
mustDeleteAcct | destroyMPTIssuance | mustModifyVault,
|
||||
({
|
||||
{sfVaultID, soeREQUIRED},
|
||||
{sfMemoData, soeOPTIONAL},
|
||||
}))
|
||||
|
||||
/** This transaction trades assets for shares with a vault. */
|
||||
|
||||
@@ -25,7 +25,6 @@ namespace jss {
|
||||
JSS(AL_size); // out: GetCounts
|
||||
JSS(AL_hit_rate); // out: GetCounts
|
||||
JSS(AcceptedCredentials); // out: AccountObjects
|
||||
JSS(ACCOUNT_SET_FLAGS); // out: RPC server_definitions
|
||||
JSS(Account); // in: TransactionSign; field.
|
||||
JSS(AMMID); // field
|
||||
JSS(Amount); // in: TransactionSign; field.
|
||||
@@ -188,7 +187,6 @@ JSS(closed_ledger); // out: NetworkOPs
|
||||
JSS(cluster); // out: PeerImp
|
||||
JSS(code); // out: errors
|
||||
JSS(command); // in: RPCHandler
|
||||
JSS(common); // out: RPC server_definitions
|
||||
JSS(complete); // out: NetworkOPs, InboundLedger
|
||||
JSS(complete_ledgers); // out: NetworkOPs, PeerImp
|
||||
JSS(consensus); // out: NetworkOPs, LedgerConsensus
|
||||
@@ -358,8 +356,6 @@ JSS(ledger_min); // in, out: AccountTx*
|
||||
JSS(ledger_time); // out: NetworkOPs
|
||||
JSS(LEDGER_ENTRY_TYPES); // out: RPC server_definitions
|
||||
// matches definitions.json format
|
||||
JSS(LEDGER_ENTRY_FLAGS); // out: RPC server_definitions
|
||||
JSS(LEDGER_ENTRY_FORMATS); // out: RPC server_definitions
|
||||
JSS(levels); // LogLevels
|
||||
JSS(limit); // in/out: AccountTx*, AccountOffers,
|
||||
// AccountLines, AccountObjects
|
||||
@@ -461,7 +457,6 @@ JSS(open); // out: handlers/Ledger
|
||||
JSS(open_ledger_cost); // out: SubmitTransaction
|
||||
JSS(open_ledger_fee); // out: TxQ
|
||||
JSS(open_ledger_level); // out: TxQ
|
||||
JSS(optionality); // out: server_definitions
|
||||
JSS(oracles); // in: get_aggregate_price
|
||||
JSS(oracle_document_id); // in: get_aggregate_price
|
||||
JSS(owner); // in: LedgerEntry, out: NetworkOPs
|
||||
@@ -621,8 +616,6 @@ JSS(TRANSACTION_RESULTS); // out: RPC server_definitions
|
||||
// matches definitions.json format
|
||||
JSS(TRANSACTION_TYPES); // out: RPC server_definitions
|
||||
// matches definitions.json format
|
||||
JSS(TRANSACTION_FLAGS); // out: RPC server_definitions
|
||||
JSS(TRANSACTION_FORMATS); // out: RPC server_definitions
|
||||
JSS(TYPES); // out: RPC server_definitions
|
||||
// matches definitions.json format
|
||||
JSS(transfer_rate); // out: nft_info (clio)
|
||||
|
||||
@@ -1,152 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/LedgerFormats.h>
|
||||
#include <xrpl/protocol/SField.h>
|
||||
#include <xrpl/protocol/STLedgerEntry.h>
|
||||
#include <xrpl/protocol_autogen/STObjectValidation.h>
|
||||
#include <xrpl/protocol_autogen/Utils.h>
|
||||
|
||||
#include <optional>
|
||||
#include <string>
|
||||
|
||||
namespace xrpl::ledger_entries {
|
||||
|
||||
/**
|
||||
* @brief Base class for type-safe ledger entry wrappers.
|
||||
*
|
||||
* This class provides common functionality for all ledger entry types,
|
||||
* including access to common fields (sfLedgerIndex, sfLedgerEntryType, sfFlags).
|
||||
*
|
||||
* This is an immutable wrapper around SLE (Serialized Ledger Entry).
|
||||
* Use the corresponding Builder classes to construct new ledger entries.
|
||||
*/
|
||||
class LedgerEntryBase
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* @brief Construct a ledger entry wrapper from an existing SLE object.
|
||||
* @param sle The underlying serialized ledger entry to wrap
|
||||
*/
|
||||
explicit LedgerEntryBase(SLE const& sle) : sle_(sle)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Validate the ledger entry
|
||||
* @return true if validation passes, false otherwise
|
||||
*/
|
||||
[[nodiscard]]
|
||||
bool
|
||||
validate()
|
||||
{
|
||||
if (!sle_.isFieldPresent(sfLedgerEntryType))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
auto ledgerEntryType = static_cast<LedgerEntryType>(sle_.getFieldU16(sfLedgerEntryType));
|
||||
return protocol_autogen::validateSTObject(
|
||||
sle_, LedgerFormats::getInstance().findByType(ledgerEntryType)->getSOTemplate());
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the ledger entry type.
|
||||
* @return The type of this ledger entry
|
||||
*/
|
||||
[[nodiscard]]
|
||||
LedgerEntryType
|
||||
getType() const
|
||||
{
|
||||
return sle_.getType();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the key (index) of this ledger entry.
|
||||
*
|
||||
* The key uniquely identifies this ledger entry in the ledger state.
|
||||
* @return A constant reference to the 256-bit key
|
||||
*/
|
||||
[[nodiscard]]
|
||||
uint256 const&
|
||||
getKey() const
|
||||
{
|
||||
return sle_.key();
|
||||
}
|
||||
|
||||
// Common field getters (from LedgerFormats.cpp commonFields)
|
||||
|
||||
/**
|
||||
* @brief Get the ledger index (sfLedgerIndex).
|
||||
*
|
||||
* This field is OPTIONAL and represents the index of the ledger entry.
|
||||
* @return The ledger index if present, std::nullopt otherwise
|
||||
*/
|
||||
[[nodiscard]]
|
||||
std::optional<uint256>
|
||||
getLedgerIndex() const
|
||||
{
|
||||
if (sle_.isFieldPresent(sfLedgerIndex))
|
||||
{
|
||||
return sle_.at(sfLedgerIndex);
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Check if the ledger entry has a ledger index.
|
||||
* @return true if sfLedgerIndex is present, false otherwise
|
||||
*/
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasLedgerIndex() const
|
||||
{
|
||||
return sle_.isFieldPresent(sfLedgerIndex);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the ledger entry type field (sfLedgerEntryType).
|
||||
*
|
||||
* This field is REQUIRED for all ledger entries and indicates the type
|
||||
* of the ledger entry (e.g., AccountRoot, RippleState, Offer, etc.).
|
||||
* @return The ledger entry type as a 16-bit unsigned integer
|
||||
*/
|
||||
[[nodiscard]]
|
||||
uint16_t
|
||||
getLedgerEntryType() const
|
||||
{
|
||||
return sle_.at(sfLedgerEntryType);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the flags field (sfFlags).
|
||||
*
|
||||
* This field is REQUIRED for all ledger entries and contains
|
||||
* type-specific flags that modify the behavior of the ledger entry.
|
||||
* @return The flags value as a 32-bit unsigned integer
|
||||
*/
|
||||
[[nodiscard]]
|
||||
std::uint32_t
|
||||
getFlags() const
|
||||
{
|
||||
return sle_.at(sfFlags);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the underlying SLE object.
|
||||
*
|
||||
* Provides direct access to the wrapped serialized ledger entry object
|
||||
* for cases where the type-safe accessors are insufficient.
|
||||
* @return A constant reference to the underlying SLE object
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SLE const&
|
||||
getSle() const
|
||||
{
|
||||
return sle_;
|
||||
}
|
||||
|
||||
protected:
|
||||
/** @brief The underlying serialized ledger entry being wrapped. */
|
||||
SLE const& sle_;
|
||||
};
|
||||
|
||||
} // namespace xrpl::ledger_entries
|
||||
@@ -1,78 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/LedgerFormats.h>
|
||||
#include <xrpl/protocol/SField.h>
|
||||
#include <xrpl/protocol/STAccount.h>
|
||||
#include <xrpl/protocol/STAmount.h>
|
||||
#include <xrpl/protocol/STBlob.h>
|
||||
#include <xrpl/protocol/STInteger.h>
|
||||
#include <xrpl/protocol/STLedgerEntry.h>
|
||||
#include <xrpl/protocol/STObject.h>
|
||||
#include <xrpl/protocol_autogen/STObjectValidation.h>
|
||||
|
||||
namespace xrpl::ledger_entries {
|
||||
|
||||
/**
|
||||
* Base class for all ledger entry builders.
|
||||
* Provides common field setters that are available for all ledger entry types.
|
||||
*/
|
||||
template <typename Derived>
|
||||
class LedgerEntryBuilderBase
|
||||
{
|
||||
public:
|
||||
LedgerEntryBuilderBase() = default;
|
||||
|
||||
LedgerEntryBuilderBase(
|
||||
SF_UINT16::type::value_type ledgerEntryType,
|
||||
SF_UINT32::type::value_type flags = 0)
|
||||
{
|
||||
object_[sfLedgerEntryType] = ledgerEntryType;
|
||||
object_[sfFlags] = flags;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Validate the ledger entry
|
||||
* @return true if validation passes, false otherwise
|
||||
*/
|
||||
[[nodiscard]]
|
||||
bool
|
||||
validate()
|
||||
{
|
||||
if (!object_.isFieldPresent(sfLedgerEntryType))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
auto ledgerEntryType = static_cast<LedgerEntryType>(object_.getFieldU16(sfLedgerEntryType));
|
||||
return protocol_autogen::validateSTObject(
|
||||
object_, LedgerFormats::getInstance().findByType(ledgerEntryType)->getSOTemplate());
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the ledger index.
|
||||
* @param value Ledger index
|
||||
* @return Reference to the derived builder for method chaining.
|
||||
*/
|
||||
Derived&
|
||||
setLedgerIndex(uint256 const& value)
|
||||
{
|
||||
object_[sfLedgerIndex] = value;
|
||||
return static_cast<Derived&>(*this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the flags.
|
||||
* @param value Flags value
|
||||
* @return Reference to the derived builder for method chaining.
|
||||
*/
|
||||
Derived&
|
||||
setFlags(uint32_t value)
|
||||
{
|
||||
object_.setFieldU32(sfFlags, value);
|
||||
return static_cast<Derived&>(*this);
|
||||
}
|
||||
|
||||
protected:
|
||||
STObject object_{sfLedgerEntry};
|
||||
};
|
||||
|
||||
} // namespace xrpl::ledger_entries
|
||||
@@ -1,81 +0,0 @@
|
||||
<!-- cspell:words pyparsing -->
|
||||
|
||||
# Protocol Autogen
|
||||
|
||||
This directory contains auto-generated C++ wrapper classes for XRP Ledger protocol types.
|
||||
|
||||
## Generated Files
|
||||
|
||||
The files in this directory are automatically generated at **CMake configure time** from macro definition files:
|
||||
|
||||
- **Transaction classes** (in `transactions/`): Generated from `include/xrpl/protocol/detail/transactions.macro` by `scripts/generate_tx_classes.py`
|
||||
- **Ledger entry classes** (in `ledger_objects/`): Generated from `include/xrpl/protocol/detail/ledger_entries.macro` by `scripts/generate_ledger_classes.py`
|
||||
|
||||
## Generation Process
|
||||
|
||||
The generation happens automatically when you **configure** the project (not during build). When you run CMake, the system:
|
||||
|
||||
1. Creates a Python virtual environment in the build directory (`codegen_venv`)
|
||||
2. Installs Python dependencies from `scripts/requirements.txt` into the venv (only if needed)
|
||||
3. Runs the Python generation scripts using the venv Python interpreter
|
||||
4. Parses the macro files to extract type definitions
|
||||
5. Generates type-safe C++ wrapper classes using Mako templates
|
||||
6. Places the generated headers in this directory
|
||||
|
||||
### When Regeneration Happens
|
||||
|
||||
The code is regenerated when:
|
||||
|
||||
- You run CMake configure for the first time
|
||||
- The Python virtual environment doesn't exist
|
||||
- `scripts/requirements.txt` has been modified
|
||||
|
||||
To force regeneration, delete the build directory and reconfigure.
|
||||
|
||||
### Python Dependencies
|
||||
|
||||
The code generation requires the following Python packages (automatically installed):
|
||||
|
||||
- `pcpp` - C preprocessor for Python
|
||||
- `pyparsing` - Parser combinator library
|
||||
- `Mako` - Template engine
|
||||
|
||||
These are isolated in a virtual environment and won't affect your system Python installation.
|
||||
|
||||
## Version Control
|
||||
|
||||
The generated `.h` files **are checked into version control**. This means:
|
||||
|
||||
- Developers without Python 3 can still build the project using the committed files
|
||||
- CI/CD systems don't need to run code generation if files are up to date
|
||||
- Changes to generated files are visible in code review
|
||||
|
||||
## Modifying Generated Code
|
||||
|
||||
**Do not manually edit generated files.** Any changes will be overwritten the next time CMake configure runs.
|
||||
|
||||
To modify the generated classes:
|
||||
|
||||
- Edit the macro files in `include/xrpl/protocol/detail/`
|
||||
- Edit the Mako templates in `scripts/templates/`
|
||||
- Edit the generation scripts in `scripts/`
|
||||
- Update Python dependencies in `scripts/requirements.txt`
|
||||
- Run CMake configure to regenerate
|
||||
|
||||
## Adding Common Fields
|
||||
|
||||
If you add a new common field to `TxFormats.cpp` or `LedgerFormats.cpp`, you should also update the corresponding base classes and templates manually:
|
||||
|
||||
Base classes:
|
||||
|
||||
- `TransactionBase.h` - Add getters for new common transaction fields
|
||||
- `TransactionBuilderBase.h` - Add setters, and if the field is required, add it to the constructor parameters
|
||||
- `LedgerEntryBase.h` - Add getters for new common ledger entry fields
|
||||
- `LedgerEntryBuilderBase.h` - Add setters, and if the field is required, add it to the constructor parameters
|
||||
|
||||
Templates (update to pass required common fields to base class constructors):
|
||||
|
||||
- `scripts/templates/Transaction.h.mako`
|
||||
- `scripts/templates/LedgerEntry.h.mako`
|
||||
|
||||
These files are **not auto-generated** and must be updated by hand.
|
||||
@@ -1,32 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/SOTemplate.h>
|
||||
#include <xrpl/protocol/STObject.h>
|
||||
|
||||
namespace xrpl::protocol_autogen {
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
validateSTObject(STObject const& obj, SOTemplate const& format)
|
||||
{
|
||||
for (auto const& field : format)
|
||||
{
|
||||
if (obj.isFieldPresent(field.sField()) && field.style() == soeREQUIRED)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!field.supportMPT() && obj.isFieldPresent(field.sField()) &&
|
||||
field.sField().fieldType == STI_ISSUE)
|
||||
{
|
||||
auto const& amount = obj.getFieldAmount(field.sField());
|
||||
|
||||
if (amount.asset().holds<MPTIssue>())
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace xrpl::protocol_autogen
|
||||
@@ -1,444 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/SField.h>
|
||||
#include <xrpl/protocol/STAccount.h>
|
||||
#include <xrpl/protocol/STArray.h>
|
||||
#include <xrpl/protocol/STObject.h>
|
||||
#include <xrpl/protocol/STTx.h>
|
||||
#include <xrpl/protocol/TxFormats.h>
|
||||
#include <xrpl/protocol_autogen/STObjectValidation.h>
|
||||
#include <xrpl/protocol_autogen/Utils.h>
|
||||
|
||||
#include <optional>
|
||||
#include <string>
|
||||
|
||||
namespace xrpl::transactions {
|
||||
|
||||
/**
|
||||
* @brief Base class for all transaction wrapper types.
|
||||
*
|
||||
* Provides type-safe read-only accessors for common transaction fields.
|
||||
* This is an immutable wrapper around STTx. Use the corresponding Builder classes
|
||||
* to construct new transactions.
|
||||
*/
|
||||
class TransactionBase
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* @brief Construct a transaction wrapper from an existing STTx object.
|
||||
* @param tx The underlying transaction object to wrap
|
||||
*/
|
||||
explicit TransactionBase(STTx const& tx) : tx_(tx)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Validate the transaction
|
||||
* @return true if validation passes, false otherwise
|
||||
*/
|
||||
[[nodiscard]]
|
||||
bool
|
||||
validate() const
|
||||
{
|
||||
return protocol_autogen::validateSTObject(
|
||||
tx_, TxFormats::getInstance().findByType(tx_.getTxnType())->getSOTemplate());
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the transaction type.
|
||||
* @return The type of this transaction
|
||||
*/
|
||||
[[nodiscard]]
|
||||
xrpl::TxType
|
||||
getTransactionType() const
|
||||
{
|
||||
return tx_.getTxnType();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the account initiating the transaction (sfAccount).
|
||||
*
|
||||
* This field is REQUIRED for all transactions.
|
||||
* @return The account ID of the transaction sender
|
||||
*/
|
||||
[[nodiscard]]
|
||||
AccountID
|
||||
getAccount() const
|
||||
{
|
||||
return tx_.at(sfAccount);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the sequence number of the transaction (sfSequence).
|
||||
*
|
||||
* This field is REQUIRED for all transactions.
|
||||
* @return The sequence number
|
||||
*/
|
||||
[[nodiscard]]
|
||||
std::uint32_t
|
||||
getSequence() const
|
||||
{
|
||||
return tx_.at(sfSequence);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the transaction fee (sfFee).
|
||||
*
|
||||
* This field is REQUIRED for all transactions.
|
||||
* @return The fee amount
|
||||
*/
|
||||
[[nodiscard]]
|
||||
STAmount
|
||||
getFee() const
|
||||
{
|
||||
return tx_.at(sfFee);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the signing public key (sfSigningPubKey).
|
||||
*
|
||||
* This field is REQUIRED for all transactions.
|
||||
* @return The public key used for signing as a blob
|
||||
*/
|
||||
[[nodiscard]]
|
||||
Blob
|
||||
getSigningPubKey() const
|
||||
{
|
||||
return tx_.getFieldVL(sfSigningPubKey);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the transaction flags (sfFlags).
|
||||
*
|
||||
* This field is OPTIONAL.
|
||||
* @return The flags value if present, std::nullopt otherwise
|
||||
*/
|
||||
[[nodiscard]]
|
||||
std::optional<uint32_t>
|
||||
getFlags() const
|
||||
{
|
||||
if (tx_.isFieldPresent(sfFlags))
|
||||
return tx_.at(sfFlags);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Check if the transaction has flags set.
|
||||
* @return true if sfFlags is present, false otherwise
|
||||
*/
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasFlags() const
|
||||
{
|
||||
return tx_.isFieldPresent(sfFlags);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the source tag (sfSourceTag).
|
||||
*
|
||||
* This field is OPTIONAL and used to identify the source of a payment.
|
||||
* @return The source tag value if present, std::nullopt otherwise
|
||||
*/
|
||||
[[nodiscard]]
|
||||
std::optional<uint32_t>
|
||||
getSourceTag() const
|
||||
{
|
||||
if (tx_.isFieldPresent(sfSourceTag))
|
||||
return tx_.at(sfSourceTag);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Check if the transaction has a source tag.
|
||||
* @return true if sfSourceTag is present, false otherwise
|
||||
*/
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasSourceTag() const
|
||||
{
|
||||
return tx_.isFieldPresent(sfSourceTag);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the previous transaction ID (sfPreviousTxnID).
|
||||
*
|
||||
* This field is OPTIONAL and used for transaction chaining.
|
||||
* @return The previous transaction ID if present, std::nullopt otherwise
|
||||
*/
|
||||
[[nodiscard]]
|
||||
std::optional<uint256>
|
||||
getPreviousTxnID() const
|
||||
{
|
||||
if (tx_.isFieldPresent(sfPreviousTxnID))
|
||||
return tx_.at(sfPreviousTxnID);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Check if the transaction has a previous transaction ID.
|
||||
* @return true if sfPreviousTxnID is present, false otherwise
|
||||
*/
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasPreviousTxnID() const
|
||||
{
|
||||
return tx_.isFieldPresent(sfPreviousTxnID);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the last ledger sequence (sfLastLedgerSequence).
|
||||
*
|
||||
* This field is OPTIONAL and specifies the latest ledger sequence
|
||||
* in which this transaction can be included.
|
||||
* @return The last ledger sequence if present, std::nullopt otherwise
|
||||
*/
|
||||
[[nodiscard]]
|
||||
std::optional<uint32_t>
|
||||
getLastLedgerSequence() const
|
||||
{
|
||||
if (tx_.isFieldPresent(sfLastLedgerSequence))
|
||||
return tx_.at(sfLastLedgerSequence);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Check if the transaction has a last ledger sequence.
|
||||
* @return true if sfLastLedgerSequence is present, false otherwise
|
||||
*/
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasLastLedgerSequence() const
|
||||
{
|
||||
return tx_.isFieldPresent(sfLastLedgerSequence);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the account transaction ID (sfAccountTxnID).
|
||||
*
|
||||
* This field is OPTIONAL and used to track transaction sequences.
|
||||
* @return The account transaction ID if present, std::nullopt otherwise
|
||||
*/
|
||||
[[nodiscard]]
|
||||
std::optional<uint256>
|
||||
getAccountTxnID() const
|
||||
{
|
||||
if (tx_.isFieldPresent(sfAccountTxnID))
|
||||
return tx_.at(sfAccountTxnID);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Check if the transaction has an account transaction ID.
|
||||
* @return true if sfAccountTxnID is present, false otherwise
|
||||
*/
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasAccountTxnID() const
|
||||
{
|
||||
return tx_.isFieldPresent(sfAccountTxnID);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the operation limit (sfOperationLimit).
|
||||
*
|
||||
* This field is OPTIONAL and limits the number of operations in a transaction.
|
||||
* @return The operation limit if present, std::nullopt otherwise
|
||||
*/
|
||||
[[nodiscard]]
|
||||
std::optional<uint32_t>
|
||||
getOperationLimit() const
|
||||
{
|
||||
if (tx_.isFieldPresent(sfOperationLimit))
|
||||
return tx_.at(sfOperationLimit);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Check if the transaction has an operation limit.
|
||||
* @return true if sfOperationLimit is present, false otherwise
|
||||
*/
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasOperationLimit() const
|
||||
{
|
||||
return tx_.isFieldPresent(sfOperationLimit);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the memos array (sfMemos).
|
||||
*
|
||||
* This field is OPTIONAL and contains arbitrary data attached to the transaction.
|
||||
* @note This is an untyped field (STArray).
|
||||
* @return A reference wrapper to the memos array if present, std::nullopt otherwise
|
||||
*/
|
||||
[[nodiscard]]
|
||||
std::optional<std::reference_wrapper<STArray const>>
|
||||
getMemos() const
|
||||
{
|
||||
if (tx_.isFieldPresent(sfMemos))
|
||||
return tx_.getFieldArray(sfMemos);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Check if the transaction has memos.
|
||||
* @return true if sfMemos is present, false otherwise
|
||||
*/
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasMemos() const
|
||||
{
|
||||
return tx_.isFieldPresent(sfMemos);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the ticket sequence (sfTicketSequence).
|
||||
*
|
||||
* This field is OPTIONAL and used when consuming a ticket instead of a sequence number.
|
||||
* @return The ticket sequence if present, std::nullopt otherwise
|
||||
*/
|
||||
[[nodiscard]]
|
||||
std::optional<uint32_t>
|
||||
getTicketSequence() const
|
||||
{
|
||||
if (tx_.isFieldPresent(sfTicketSequence))
|
||||
return tx_.at(sfTicketSequence);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Check if the transaction has a ticket sequence.
|
||||
* @return true if sfTicketSequence is present, false otherwise
|
||||
*/
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasTicketSequence() const
|
||||
{
|
||||
return tx_.isFieldPresent(sfTicketSequence);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the transaction signature (sfTxnSignature).
|
||||
*
|
||||
* This field is OPTIONAL and contains the signature for single-signed transactions.
|
||||
* @return The transaction signature as a blob if present, std::nullopt otherwise
|
||||
*/
|
||||
[[nodiscard]]
|
||||
std::optional<Blob>
|
||||
getTxnSignature() const
|
||||
{
|
||||
if (tx_.isFieldPresent(sfTxnSignature))
|
||||
return tx_.getFieldVL(sfTxnSignature);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Check if the transaction has a transaction signature.
|
||||
* @return true if sfTxnSignature is present, false otherwise
|
||||
*/
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasTxnSignature() const
|
||||
{
|
||||
return tx_.isFieldPresent(sfTxnSignature);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the signers array (sfSigners).
|
||||
*
|
||||
* This field is OPTIONAL and contains the list of signers for multi-signed transactions.
|
||||
* @note This is an untyped field (STArray).
|
||||
* @return A reference wrapper to the signers array if present, std::nullopt otherwise
|
||||
*/
|
||||
[[nodiscard]]
|
||||
std::optional<std::reference_wrapper<STArray const>>
|
||||
getSigners() const
|
||||
{
|
||||
if (tx_.isFieldPresent(sfSigners))
|
||||
return tx_.getFieldArray(sfSigners);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Check if the transaction has signers.
|
||||
* @return true if sfSigners is present, false otherwise
|
||||
*/
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasSigners() const
|
||||
{
|
||||
return tx_.isFieldPresent(sfSigners);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the network ID (sfNetworkID).
|
||||
*
|
||||
* This field is OPTIONAL and identifies the network this transaction is intended for.
|
||||
* @return The network ID if present, std::nullopt otherwise
|
||||
*/
|
||||
[[nodiscard]]
|
||||
std::optional<uint32_t>
|
||||
getNetworkID() const
|
||||
{
|
||||
if (tx_.isFieldPresent(sfNetworkID))
|
||||
return tx_.at(sfNetworkID);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Check if the transaction has a network ID.
|
||||
* @return true if sfNetworkID is present, false otherwise
|
||||
*/
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasNetworkID() const
|
||||
{
|
||||
return tx_.isFieldPresent(sfNetworkID);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the delegate account (sfDelegate).
|
||||
*
|
||||
* This field is OPTIONAL and specifies a delegate account for the transaction.
|
||||
* @return The delegate account ID if present, std::nullopt otherwise
|
||||
*/
|
||||
[[nodiscard]]
|
||||
std::optional<AccountID>
|
||||
getDelegate() const
|
||||
{
|
||||
if (tx_.isFieldPresent(sfDelegate))
|
||||
return tx_.at(sfDelegate);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Check if the transaction has a delegate account.
|
||||
* @return true if sfDelegate is present, false otherwise
|
||||
*/
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasDelegate() const
|
||||
{
|
||||
return tx_.isFieldPresent(sfDelegate);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the underlying STTx object.
|
||||
*
|
||||
* Provides direct access to the wrapped transaction object for cases
|
||||
* where the type-safe accessors are insufficient.
|
||||
* @return A constant reference to the underlying STTx object
|
||||
*/
|
||||
[[nodiscard]]
|
||||
STTx const&
|
||||
getSTTx() const
|
||||
{
|
||||
return tx_;
|
||||
}
|
||||
|
||||
protected:
|
||||
/** @brief The underlying transaction object being wrapped. */
|
||||
STTx const& tx_;
|
||||
};
|
||||
|
||||
} // namespace xrpl::transactions
|
||||
@@ -1,182 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/HashPrefix.h>
|
||||
#include <xrpl/protocol/PublicKey.h>
|
||||
#include <xrpl/protocol/SField.h>
|
||||
#include <xrpl/protocol/STAccount.h>
|
||||
#include <xrpl/protocol/STAmount.h>
|
||||
#include <xrpl/protocol/STBlob.h>
|
||||
#include <xrpl/protocol/STInteger.h>
|
||||
#include <xrpl/protocol/STObject.h>
|
||||
#include <xrpl/protocol/STXChainBridge.h>
|
||||
#include <xrpl/protocol/SecretKey.h>
|
||||
#include <xrpl/protocol/Serializer.h>
|
||||
#include <xrpl/protocol/TxFormats.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/STObjectValidation.h>
|
||||
|
||||
namespace xrpl::transactions {
|
||||
|
||||
/**
|
||||
* Base class for all transaction builders.
|
||||
* Provides common field setters that are available for all transaction types.
|
||||
*/
|
||||
template <typename Derived>
|
||||
class TransactionBuilderBase
|
||||
{
|
||||
public:
|
||||
TransactionBuilderBase() = default;
|
||||
|
||||
TransactionBuilderBase(
|
||||
SF_UINT16::type::value_type transactionType,
|
||||
SF_ACCOUNT::type::value_type account,
|
||||
std::optional<SF_UINT32::type::value_type> sequence,
|
||||
std::optional<SF_AMOUNT::type::value_type> fee)
|
||||
{
|
||||
object_[sfTransactionType] = transactionType;
|
||||
setAccount(account);
|
||||
|
||||
if (sequence)
|
||||
{
|
||||
setSequence(*sequence);
|
||||
}
|
||||
if (fee)
|
||||
{
|
||||
setFee(*fee);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Validate the transaction
|
||||
* @return true if validation passes, false otherwise
|
||||
*/
|
||||
[[nodiscard]]
|
||||
bool
|
||||
validate()
|
||||
{
|
||||
if (!object_.isFieldPresent(sfTransactionType))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
auto transactionType = static_cast<TxType>(object_.getFieldU16(sfTransactionType));
|
||||
return protocol_autogen::validateSTObject(
|
||||
object_, TxFormats::getInstance().findByType(transactionType)->getSOTemplate());
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the account that is sending the transaction.
|
||||
* @param value Account address (typically as a string)
|
||||
* @return Reference to the derived builder for method chaining.
|
||||
*/
|
||||
Derived&
|
||||
setAccount(AccountID const& value)
|
||||
{
|
||||
object_[sfAccount] = value;
|
||||
return static_cast<Derived&>(*this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the transaction fee.
|
||||
* @param value Fee in drops (typically as a string or number)
|
||||
* @return Reference to the derived builder for method chaining.
|
||||
*/
|
||||
Derived&
|
||||
setFee(STAmount const& value)
|
||||
{
|
||||
object_[sfFee] = value;
|
||||
return static_cast<Derived&>(*this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the sequence number.
|
||||
* @param value Sequence number
|
||||
* @return Reference to the derived builder for method chaining.
|
||||
*/
|
||||
Derived&
|
||||
setSequence(std::uint32_t const& value)
|
||||
{
|
||||
object_[sfSequence] = value;
|
||||
return static_cast<Derived&>(*this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set transaction flags.
|
||||
* @param value Flags value
|
||||
* @return Reference to the derived builder for method chaining.
|
||||
*/
|
||||
Derived&
|
||||
setFlags(std::uint32_t const& value)
|
||||
{
|
||||
object_[sfFlags] = value;
|
||||
return static_cast<Derived&>(*this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the source tag.
|
||||
* @param value Source tag
|
||||
* @return Reference to the derived builder for method chaining.
|
||||
*/
|
||||
Derived&
|
||||
setSourceTag(std::uint32_t const& value)
|
||||
{
|
||||
object_[sfSourceTag] = value;
|
||||
return static_cast<Derived&>(*this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the last ledger sequence.
|
||||
* @param value Last ledger sequence number
|
||||
* @return Reference to the derived builder for method chaining.
|
||||
*/
|
||||
Derived&
|
||||
setLastLedgerSequence(std::uint32_t const& value)
|
||||
{
|
||||
object_[sfLastLedgerSequence] = value;
|
||||
return static_cast<Derived&>(*this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the account transaction ID.
|
||||
* @param value Account transaction ID (typically as a hex string)
|
||||
* @return Reference to the derived builder for method chaining.
|
||||
*/
|
||||
Derived&
|
||||
setAccountTxnID(uint256 const& value)
|
||||
{
|
||||
object_[sfAccountTxnID] = value;
|
||||
return static_cast<Derived&>(*this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sign the transaction with the given keys.
|
||||
*
|
||||
* This sets the SigningPubKey field and computes the TxnSignature.
|
||||
*
|
||||
* @param publicKey The public key for signing
|
||||
* @param secretKey The secret key for signing
|
||||
* @return Reference to the derived builder for method chaining.
|
||||
*/
|
||||
Derived&
|
||||
sign(PublicKey const& publicKey, SecretKey const& secretKey)
|
||||
{
|
||||
// Set the signing public key
|
||||
object_.setFieldVL(sfSigningPubKey, publicKey.slice());
|
||||
|
||||
// Build the signing data: HashPrefix::txSign + serialized object
|
||||
// (without signing fields)
|
||||
Serializer s;
|
||||
s.add32(HashPrefix::txSign);
|
||||
object_.addWithoutSigningFields(s);
|
||||
|
||||
// Sign and set the signature
|
||||
auto const sig = xrpl::sign(publicKey, secretKey, s.slice());
|
||||
object_.setFieldVL(sfTxnSignature, sig);
|
||||
|
||||
return static_cast<Derived&>(*this);
|
||||
}
|
||||
|
||||
protected:
|
||||
STObject object_{sfTransaction};
|
||||
};
|
||||
|
||||
} // namespace xrpl::transactions
|
||||
@@ -1,14 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <optional>
|
||||
#include <type_traits>
|
||||
|
||||
namespace xrpl::protocol_autogen {
|
||||
|
||||
template <typename ValueType>
|
||||
using Optional = std::conditional_t<
|
||||
std::is_reference_v<ValueType>,
|
||||
std::optional<std::reference_wrapper<std::remove_reference_t<ValueType>>>,
|
||||
std::optional<ValueType>>;
|
||||
|
||||
}
|
||||
@@ -1,347 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STLedgerEntry.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/LedgerEntryBase.h>
|
||||
#include <xrpl/protocol_autogen/LedgerEntryBuilderBase.h>
|
||||
#include <xrpl/json/json_value.h>
|
||||
|
||||
#include <stdexcept>
|
||||
#include <optional>
|
||||
|
||||
namespace xrpl::ledger_entries {
|
||||
|
||||
// Forward declaration
|
||||
class AMMBuilder;
|
||||
|
||||
/**
|
||||
* Ledger Entry: AMM
|
||||
* Type: ltAMM (0x0079)
|
||||
* RPC Name: amm
|
||||
*
|
||||
* Immutable wrapper around SLE providing type-safe field access.
|
||||
* Use AMMBuilder to construct new ledger entries.
|
||||
*/
|
||||
class AMM : public LedgerEntryBase
|
||||
{
|
||||
public:
|
||||
static constexpr LedgerEntryType entryType = ltAMM;
|
||||
|
||||
/**
|
||||
* Construct a AMM ledger entry wrapper from an existing SLE object.
|
||||
* @throws std::runtime_error if the ledger entry type doesn't match.
|
||||
*/
|
||||
explicit AMM(SLE const& sle)
|
||||
: LedgerEntryBase(sle)
|
||||
{
|
||||
// Verify ledger entry type
|
||||
if (sle.getType() != entryType)
|
||||
{
|
||||
throw std::runtime_error("Invalid ledger entry type for AMM");
|
||||
}
|
||||
}
|
||||
|
||||
// Ledger entry-specific field getters
|
||||
|
||||
/**
|
||||
* Get sfAccount (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_ACCOUNT::type::value_type
|
||||
getAccount() const
|
||||
{
|
||||
return this->sle_.at(sfAccount);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfTradingFee (soeDEFAULT)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT16::type::value_type>
|
||||
getTradingFee() const
|
||||
{
|
||||
if (hasTradingFee())
|
||||
return this->sle_.at(sfTradingFee);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasTradingFee() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfTradingFee);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfVoteSlots (soeOPTIONAL)
|
||||
* Note: This is an untyped field (unknown).
|
||||
*/
|
||||
[[nodiscard]]
|
||||
std::optional<std::reference_wrapper<STArray const>>
|
||||
getVoteSlots() const
|
||||
{
|
||||
if (this->sle_.isFieldPresent(sfVoteSlots))
|
||||
return this->sle_.getFieldArray(sfVoteSlots);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasVoteSlots() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfVoteSlots);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfAuctionSlot (soeOPTIONAL)
|
||||
* Note: This is an untyped field (unknown).
|
||||
*/
|
||||
[[nodiscard]]
|
||||
std::optional<STObject>
|
||||
getAuctionSlot() const
|
||||
{
|
||||
if (this->sle_.isFieldPresent(sfAuctionSlot))
|
||||
return this->sle_.getFieldObject(sfAuctionSlot);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasAuctionSlot() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfAuctionSlot);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfLPTokenBalance (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_AMOUNT::type::value_type
|
||||
getLPTokenBalance() const
|
||||
{
|
||||
return this->sle_.at(sfLPTokenBalance);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfAsset (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_ISSUE::type::value_type
|
||||
getAsset() const
|
||||
{
|
||||
return this->sle_.at(sfAsset);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfAsset2 (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_ISSUE::type::value_type
|
||||
getAsset2() const
|
||||
{
|
||||
return this->sle_.at(sfAsset2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfOwnerNode (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT64::type::value_type
|
||||
getOwnerNode() const
|
||||
{
|
||||
return this->sle_.at(sfOwnerNode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfPreviousTxnID (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT256::type::value_type>
|
||||
getPreviousTxnID() const
|
||||
{
|
||||
if (hasPreviousTxnID())
|
||||
return this->sle_.at(sfPreviousTxnID);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasPreviousTxnID() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfPreviousTxnID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfPreviousTxnLgrSeq (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT32::type::value_type>
|
||||
getPreviousTxnLgrSeq() const
|
||||
{
|
||||
if (hasPreviousTxnLgrSeq())
|
||||
return this->sle_.at(sfPreviousTxnLgrSeq);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasPreviousTxnLgrSeq() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfPreviousTxnLgrSeq);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Builder for AMM ledger entries.
|
||||
* Provides a fluent interface for constructing ledger entries with method chaining.
|
||||
* Uses Json::Value internally for flexible ledger entry construction.
|
||||
* Inherits common field setters from LedgerEntryBuilderBase.
|
||||
*/
|
||||
class AMMBuilder : public LedgerEntryBuilderBase<AMMBuilder>
|
||||
{
|
||||
public:
|
||||
AMMBuilder(std::decay_t<typename SF_ACCOUNT::type::value_type> const& account,std::decay_t<typename SF_AMOUNT::type::value_type> const& lPTokenBalance,std::decay_t<typename SF_ISSUE::type::value_type> const& asset,std::decay_t<typename SF_ISSUE::type::value_type> const& asset2,std::decay_t<typename SF_UINT64::type::value_type> const& ownerNode)
|
||||
: LedgerEntryBuilderBase<AMMBuilder>(ltAMM)
|
||||
{
|
||||
setAccount(account);
|
||||
setLPTokenBalance(lPTokenBalance);
|
||||
setAsset(asset);
|
||||
setAsset2(asset2);
|
||||
setOwnerNode(ownerNode);
|
||||
}
|
||||
|
||||
AMMBuilder(SLE const& sle)
|
||||
{
|
||||
if (sle[sfLedgerEntryType] != ltAMM)
|
||||
{
|
||||
throw std::runtime_error("Invalid ledger entry type for AMM");
|
||||
}
|
||||
object_ = sle;
|
||||
}
|
||||
|
||||
// Ledger entry-specific field setters
|
||||
|
||||
/**
|
||||
* Set sfAccount (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
AMMBuilder&
|
||||
setAccount(std::decay_t<typename SF_ACCOUNT::type::value_type> const& value)
|
||||
{
|
||||
object_[sfAccount] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfTradingFee (soeDEFAULT)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
AMMBuilder&
|
||||
setTradingFee(std::decay_t<typename SF_UINT16::type::value_type> const& value)
|
||||
{
|
||||
object_[sfTradingFee] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfVoteSlots (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
AMMBuilder&
|
||||
setVoteSlots(STArray const& value)
|
||||
{
|
||||
object_.setFieldArray(sfVoteSlots, value);
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfAuctionSlot (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
AMMBuilder&
|
||||
setAuctionSlot(STObject const& value)
|
||||
{
|
||||
object_.setFieldObject(sfAuctionSlot, value);
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfLPTokenBalance (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
AMMBuilder&
|
||||
setLPTokenBalance(std::decay_t<typename SF_AMOUNT::type::value_type> const& value)
|
||||
{
|
||||
object_[sfLPTokenBalance] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfAsset (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
AMMBuilder&
|
||||
setAsset(std::decay_t<typename SF_ISSUE::type::value_type> const& value)
|
||||
{
|
||||
object_[sfAsset] = STIssue(sfAsset, value);
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfAsset2 (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
AMMBuilder&
|
||||
setAsset2(std::decay_t<typename SF_ISSUE::type::value_type> const& value)
|
||||
{
|
||||
object_[sfAsset2] = STIssue(sfAsset2, value);
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfOwnerNode (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
AMMBuilder&
|
||||
setOwnerNode(std::decay_t<typename SF_UINT64::type::value_type> const& value)
|
||||
{
|
||||
object_[sfOwnerNode] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfPreviousTxnID (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
AMMBuilder&
|
||||
setPreviousTxnID(std::decay_t<typename SF_UINT256::type::value_type> const& value)
|
||||
{
|
||||
object_[sfPreviousTxnID] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfPreviousTxnLgrSeq (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
AMMBuilder&
|
||||
setPreviousTxnLgrSeq(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfPreviousTxnLgrSeq] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build and return the completed AMM wrapper.
|
||||
* @return The constructed ledger entry wrapper.
|
||||
* @throws std::runtime_error if the JSON cannot be parsed into a valid ledger entry.
|
||||
*/
|
||||
AMM
|
||||
build(uint256 const& index)
|
||||
{
|
||||
return AMM{SLE(object_, index)};
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::ledger_entries
|
||||
@@ -1,727 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STLedgerEntry.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/LedgerEntryBase.h>
|
||||
#include <xrpl/protocol_autogen/LedgerEntryBuilderBase.h>
|
||||
#include <xrpl/json/json_value.h>
|
||||
|
||||
#include <stdexcept>
|
||||
#include <optional>
|
||||
|
||||
namespace xrpl::ledger_entries {
|
||||
|
||||
// Forward declaration
|
||||
class AccountRootBuilder;
|
||||
|
||||
/**
|
||||
* Ledger Entry: AccountRoot
|
||||
* Type: ltACCOUNT_ROOT (0x0061)
|
||||
* RPC Name: account
|
||||
*
|
||||
* Immutable wrapper around SLE providing type-safe field access.
|
||||
* Use AccountRootBuilder to construct new ledger entries.
|
||||
*/
|
||||
class AccountRoot : public LedgerEntryBase
|
||||
{
|
||||
public:
|
||||
static constexpr LedgerEntryType entryType = ltACCOUNT_ROOT;
|
||||
|
||||
/**
|
||||
* Construct a AccountRoot ledger entry wrapper from an existing SLE object.
|
||||
* @throws std::runtime_error if the ledger entry type doesn't match.
|
||||
*/
|
||||
explicit AccountRoot(SLE const& sle)
|
||||
: LedgerEntryBase(sle)
|
||||
{
|
||||
// Verify ledger entry type
|
||||
if (sle.getType() != entryType)
|
||||
{
|
||||
throw std::runtime_error("Invalid ledger entry type for AccountRoot");
|
||||
}
|
||||
}
|
||||
|
||||
// Ledger entry-specific field getters
|
||||
|
||||
/**
|
||||
* Get sfAccount (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_ACCOUNT::type::value_type
|
||||
getAccount() const
|
||||
{
|
||||
return this->sle_.at(sfAccount);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfSequence (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT32::type::value_type
|
||||
getSequence() const
|
||||
{
|
||||
return this->sle_.at(sfSequence);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfBalance (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_AMOUNT::type::value_type
|
||||
getBalance() const
|
||||
{
|
||||
return this->sle_.at(sfBalance);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfOwnerCount (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT32::type::value_type
|
||||
getOwnerCount() const
|
||||
{
|
||||
return this->sle_.at(sfOwnerCount);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfPreviousTxnID (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT256::type::value_type
|
||||
getPreviousTxnID() const
|
||||
{
|
||||
return this->sle_.at(sfPreviousTxnID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfPreviousTxnLgrSeq (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT32::type::value_type
|
||||
getPreviousTxnLgrSeq() const
|
||||
{
|
||||
return this->sle_.at(sfPreviousTxnLgrSeq);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfAccountTxnID (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT256::type::value_type>
|
||||
getAccountTxnID() const
|
||||
{
|
||||
if (hasAccountTxnID())
|
||||
return this->sle_.at(sfAccountTxnID);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasAccountTxnID() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfAccountTxnID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfRegularKey (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_ACCOUNT::type::value_type>
|
||||
getRegularKey() const
|
||||
{
|
||||
if (hasRegularKey())
|
||||
return this->sle_.at(sfRegularKey);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasRegularKey() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfRegularKey);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfEmailHash (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT128::type::value_type>
|
||||
getEmailHash() const
|
||||
{
|
||||
if (hasEmailHash())
|
||||
return this->sle_.at(sfEmailHash);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasEmailHash() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfEmailHash);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfWalletLocator (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT256::type::value_type>
|
||||
getWalletLocator() const
|
||||
{
|
||||
if (hasWalletLocator())
|
||||
return this->sle_.at(sfWalletLocator);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasWalletLocator() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfWalletLocator);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfWalletSize (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT32::type::value_type>
|
||||
getWalletSize() const
|
||||
{
|
||||
if (hasWalletSize())
|
||||
return this->sle_.at(sfWalletSize);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasWalletSize() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfWalletSize);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfMessageKey (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_VL::type::value_type>
|
||||
getMessageKey() const
|
||||
{
|
||||
if (hasMessageKey())
|
||||
return this->sle_.at(sfMessageKey);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasMessageKey() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfMessageKey);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfTransferRate (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT32::type::value_type>
|
||||
getTransferRate() const
|
||||
{
|
||||
if (hasTransferRate())
|
||||
return this->sle_.at(sfTransferRate);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasTransferRate() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfTransferRate);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfDomain (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_VL::type::value_type>
|
||||
getDomain() const
|
||||
{
|
||||
if (hasDomain())
|
||||
return this->sle_.at(sfDomain);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasDomain() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfDomain);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfTickSize (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT8::type::value_type>
|
||||
getTickSize() const
|
||||
{
|
||||
if (hasTickSize())
|
||||
return this->sle_.at(sfTickSize);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasTickSize() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfTickSize);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfTicketCount (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT32::type::value_type>
|
||||
getTicketCount() const
|
||||
{
|
||||
if (hasTicketCount())
|
||||
return this->sle_.at(sfTicketCount);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasTicketCount() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfTicketCount);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfNFTokenMinter (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_ACCOUNT::type::value_type>
|
||||
getNFTokenMinter() const
|
||||
{
|
||||
if (hasNFTokenMinter())
|
||||
return this->sle_.at(sfNFTokenMinter);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasNFTokenMinter() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfNFTokenMinter);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfMintedNFTokens (soeDEFAULT)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT32::type::value_type>
|
||||
getMintedNFTokens() const
|
||||
{
|
||||
if (hasMintedNFTokens())
|
||||
return this->sle_.at(sfMintedNFTokens);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasMintedNFTokens() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfMintedNFTokens);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfBurnedNFTokens (soeDEFAULT)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT32::type::value_type>
|
||||
getBurnedNFTokens() const
|
||||
{
|
||||
if (hasBurnedNFTokens())
|
||||
return this->sle_.at(sfBurnedNFTokens);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasBurnedNFTokens() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfBurnedNFTokens);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfFirstNFTokenSequence (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT32::type::value_type>
|
||||
getFirstNFTokenSequence() const
|
||||
{
|
||||
if (hasFirstNFTokenSequence())
|
||||
return this->sle_.at(sfFirstNFTokenSequence);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasFirstNFTokenSequence() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfFirstNFTokenSequence);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfAMMID (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT256::type::value_type>
|
||||
getAMMID() const
|
||||
{
|
||||
if (hasAMMID())
|
||||
return this->sle_.at(sfAMMID);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasAMMID() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfAMMID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfVaultID (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT256::type::value_type>
|
||||
getVaultID() const
|
||||
{
|
||||
if (hasVaultID())
|
||||
return this->sle_.at(sfVaultID);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasVaultID() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfVaultID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfLoanBrokerID (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT256::type::value_type>
|
||||
getLoanBrokerID() const
|
||||
{
|
||||
if (hasLoanBrokerID())
|
||||
return this->sle_.at(sfLoanBrokerID);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasLoanBrokerID() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfLoanBrokerID);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Builder for AccountRoot ledger entries.
|
||||
* Provides a fluent interface for constructing ledger entries with method chaining.
|
||||
* Uses Json::Value internally for flexible ledger entry construction.
|
||||
* Inherits common field setters from LedgerEntryBuilderBase.
|
||||
*/
|
||||
class AccountRootBuilder : public LedgerEntryBuilderBase<AccountRootBuilder>
|
||||
{
|
||||
public:
|
||||
AccountRootBuilder(std::decay_t<typename SF_ACCOUNT::type::value_type> const& account,std::decay_t<typename SF_UINT32::type::value_type> const& sequence,std::decay_t<typename SF_AMOUNT::type::value_type> const& balance,std::decay_t<typename SF_UINT32::type::value_type> const& ownerCount,std::decay_t<typename SF_UINT256::type::value_type> const& previousTxnID,std::decay_t<typename SF_UINT32::type::value_type> const& previousTxnLgrSeq)
|
||||
: LedgerEntryBuilderBase<AccountRootBuilder>(ltACCOUNT_ROOT)
|
||||
{
|
||||
setAccount(account);
|
||||
setSequence(sequence);
|
||||
setBalance(balance);
|
||||
setOwnerCount(ownerCount);
|
||||
setPreviousTxnID(previousTxnID);
|
||||
setPreviousTxnLgrSeq(previousTxnLgrSeq);
|
||||
}
|
||||
|
||||
AccountRootBuilder(SLE const& sle)
|
||||
{
|
||||
if (sle[sfLedgerEntryType] != ltACCOUNT_ROOT)
|
||||
{
|
||||
throw std::runtime_error("Invalid ledger entry type for AccountRoot");
|
||||
}
|
||||
object_ = sle;
|
||||
}
|
||||
|
||||
// Ledger entry-specific field setters
|
||||
|
||||
/**
|
||||
* Set sfAccount (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
AccountRootBuilder&
|
||||
setAccount(std::decay_t<typename SF_ACCOUNT::type::value_type> const& value)
|
||||
{
|
||||
object_[sfAccount] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfSequence (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
AccountRootBuilder&
|
||||
setSequence(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfSequence] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfBalance (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
AccountRootBuilder&
|
||||
setBalance(std::decay_t<typename SF_AMOUNT::type::value_type> const& value)
|
||||
{
|
||||
object_[sfBalance] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfOwnerCount (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
AccountRootBuilder&
|
||||
setOwnerCount(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfOwnerCount] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfPreviousTxnID (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
AccountRootBuilder&
|
||||
setPreviousTxnID(std::decay_t<typename SF_UINT256::type::value_type> const& value)
|
||||
{
|
||||
object_[sfPreviousTxnID] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfPreviousTxnLgrSeq (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
AccountRootBuilder&
|
||||
setPreviousTxnLgrSeq(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfPreviousTxnLgrSeq] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfAccountTxnID (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
AccountRootBuilder&
|
||||
setAccountTxnID(std::decay_t<typename SF_UINT256::type::value_type> const& value)
|
||||
{
|
||||
object_[sfAccountTxnID] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfRegularKey (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
AccountRootBuilder&
|
||||
setRegularKey(std::decay_t<typename SF_ACCOUNT::type::value_type> const& value)
|
||||
{
|
||||
object_[sfRegularKey] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfEmailHash (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
AccountRootBuilder&
|
||||
setEmailHash(std::decay_t<typename SF_UINT128::type::value_type> const& value)
|
||||
{
|
||||
object_[sfEmailHash] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfWalletLocator (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
AccountRootBuilder&
|
||||
setWalletLocator(std::decay_t<typename SF_UINT256::type::value_type> const& value)
|
||||
{
|
||||
object_[sfWalletLocator] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfWalletSize (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
AccountRootBuilder&
|
||||
setWalletSize(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfWalletSize] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfMessageKey (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
AccountRootBuilder&
|
||||
setMessageKey(std::decay_t<typename SF_VL::type::value_type> const& value)
|
||||
{
|
||||
object_[sfMessageKey] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfTransferRate (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
AccountRootBuilder&
|
||||
setTransferRate(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfTransferRate] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfDomain (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
AccountRootBuilder&
|
||||
setDomain(std::decay_t<typename SF_VL::type::value_type> const& value)
|
||||
{
|
||||
object_[sfDomain] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfTickSize (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
AccountRootBuilder&
|
||||
setTickSize(std::decay_t<typename SF_UINT8::type::value_type> const& value)
|
||||
{
|
||||
object_[sfTickSize] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfTicketCount (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
AccountRootBuilder&
|
||||
setTicketCount(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfTicketCount] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfNFTokenMinter (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
AccountRootBuilder&
|
||||
setNFTokenMinter(std::decay_t<typename SF_ACCOUNT::type::value_type> const& value)
|
||||
{
|
||||
object_[sfNFTokenMinter] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfMintedNFTokens (soeDEFAULT)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
AccountRootBuilder&
|
||||
setMintedNFTokens(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfMintedNFTokens] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfBurnedNFTokens (soeDEFAULT)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
AccountRootBuilder&
|
||||
setBurnedNFTokens(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfBurnedNFTokens] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfFirstNFTokenSequence (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
AccountRootBuilder&
|
||||
setFirstNFTokenSequence(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfFirstNFTokenSequence] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfAMMID (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
AccountRootBuilder&
|
||||
setAMMID(std::decay_t<typename SF_UINT256::type::value_type> const& value)
|
||||
{
|
||||
object_[sfAMMID] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfVaultID (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
AccountRootBuilder&
|
||||
setVaultID(std::decay_t<typename SF_UINT256::type::value_type> const& value)
|
||||
{
|
||||
object_[sfVaultID] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfLoanBrokerID (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
AccountRootBuilder&
|
||||
setLoanBrokerID(std::decay_t<typename SF_UINT256::type::value_type> const& value)
|
||||
{
|
||||
object_[sfLoanBrokerID] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build and return the completed AccountRoot wrapper.
|
||||
* @return The constructed ledger entry wrapper.
|
||||
* @throws std::runtime_error if the JSON cannot be parsed into a valid ledger entry.
|
||||
*/
|
||||
AccountRoot
|
||||
build(uint256 const& index)
|
||||
{
|
||||
return AccountRoot{SLE(object_, index)};
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::ledger_entries
|
||||
@@ -1,206 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STLedgerEntry.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/LedgerEntryBase.h>
|
||||
#include <xrpl/protocol_autogen/LedgerEntryBuilderBase.h>
|
||||
#include <xrpl/json/json_value.h>
|
||||
|
||||
#include <stdexcept>
|
||||
#include <optional>
|
||||
|
||||
namespace xrpl::ledger_entries {
|
||||
|
||||
// Forward declaration
|
||||
class AmendmentsBuilder;
|
||||
|
||||
/**
|
||||
* Ledger Entry: Amendments
|
||||
* Type: ltAMENDMENTS (0x0066)
|
||||
* RPC Name: amendments
|
||||
*
|
||||
* Immutable wrapper around SLE providing type-safe field access.
|
||||
* Use AmendmentsBuilder to construct new ledger entries.
|
||||
*/
|
||||
class Amendments : public LedgerEntryBase
|
||||
{
|
||||
public:
|
||||
static constexpr LedgerEntryType entryType = ltAMENDMENTS;
|
||||
|
||||
/**
|
||||
* Construct a Amendments ledger entry wrapper from an existing SLE object.
|
||||
* @throws std::runtime_error if the ledger entry type doesn't match.
|
||||
*/
|
||||
explicit Amendments(SLE const& sle)
|
||||
: LedgerEntryBase(sle)
|
||||
{
|
||||
// Verify ledger entry type
|
||||
if (sle.getType() != entryType)
|
||||
{
|
||||
throw std::runtime_error("Invalid ledger entry type for Amendments");
|
||||
}
|
||||
}
|
||||
|
||||
// Ledger entry-specific field getters
|
||||
|
||||
/**
|
||||
* Get sfAmendments (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_VECTOR256::type::value_type>
|
||||
getAmendments() const
|
||||
{
|
||||
if (hasAmendments())
|
||||
return this->sle_.at(sfAmendments);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasAmendments() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfAmendments);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfMajorities (soeOPTIONAL)
|
||||
* Note: This is an untyped field (unknown).
|
||||
*/
|
||||
[[nodiscard]]
|
||||
std::optional<std::reference_wrapper<STArray const>>
|
||||
getMajorities() const
|
||||
{
|
||||
if (this->sle_.isFieldPresent(sfMajorities))
|
||||
return this->sle_.getFieldArray(sfMajorities);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasMajorities() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfMajorities);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfPreviousTxnID (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT256::type::value_type>
|
||||
getPreviousTxnID() const
|
||||
{
|
||||
if (hasPreviousTxnID())
|
||||
return this->sle_.at(sfPreviousTxnID);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasPreviousTxnID() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfPreviousTxnID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfPreviousTxnLgrSeq (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT32::type::value_type>
|
||||
getPreviousTxnLgrSeq() const
|
||||
{
|
||||
if (hasPreviousTxnLgrSeq())
|
||||
return this->sle_.at(sfPreviousTxnLgrSeq);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasPreviousTxnLgrSeq() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfPreviousTxnLgrSeq);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Builder for Amendments ledger entries.
|
||||
* Provides a fluent interface for constructing ledger entries with method chaining.
|
||||
* Uses Json::Value internally for flexible ledger entry construction.
|
||||
* Inherits common field setters from LedgerEntryBuilderBase.
|
||||
*/
|
||||
class AmendmentsBuilder : public LedgerEntryBuilderBase<AmendmentsBuilder>
|
||||
{
|
||||
public:
|
||||
AmendmentsBuilder()
|
||||
: LedgerEntryBuilderBase<AmendmentsBuilder>(ltAMENDMENTS)
|
||||
{
|
||||
}
|
||||
|
||||
AmendmentsBuilder(SLE const& sle)
|
||||
{
|
||||
if (sle[sfLedgerEntryType] != ltAMENDMENTS)
|
||||
{
|
||||
throw std::runtime_error("Invalid ledger entry type for Amendments");
|
||||
}
|
||||
object_ = sle;
|
||||
}
|
||||
|
||||
// Ledger entry-specific field setters
|
||||
|
||||
/**
|
||||
* Set sfAmendments (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
AmendmentsBuilder&
|
||||
setAmendments(std::decay_t<typename SF_VECTOR256::type::value_type> const& value)
|
||||
{
|
||||
object_[sfAmendments] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfMajorities (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
AmendmentsBuilder&
|
||||
setMajorities(STArray const& value)
|
||||
{
|
||||
object_.setFieldArray(sfMajorities, value);
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfPreviousTxnID (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
AmendmentsBuilder&
|
||||
setPreviousTxnID(std::decay_t<typename SF_UINT256::type::value_type> const& value)
|
||||
{
|
||||
object_[sfPreviousTxnID] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfPreviousTxnLgrSeq (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
AmendmentsBuilder&
|
||||
setPreviousTxnLgrSeq(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfPreviousTxnLgrSeq] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build and return the completed Amendments wrapper.
|
||||
* @return The constructed ledger entry wrapper.
|
||||
* @throws std::runtime_error if the JSON cannot be parsed into a valid ledger entry.
|
||||
*/
|
||||
Amendments
|
||||
build(uint256 const& index)
|
||||
{
|
||||
return Amendments{SLE(object_, index)};
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::ledger_entries
|
||||
@@ -1,313 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STLedgerEntry.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/LedgerEntryBase.h>
|
||||
#include <xrpl/protocol_autogen/LedgerEntryBuilderBase.h>
|
||||
#include <xrpl/json/json_value.h>
|
||||
|
||||
#include <stdexcept>
|
||||
#include <optional>
|
||||
|
||||
namespace xrpl::ledger_entries {
|
||||
|
||||
// Forward declaration
|
||||
class BridgeBuilder;
|
||||
|
||||
/**
|
||||
* Ledger Entry: Bridge
|
||||
* Type: ltBRIDGE (0x0069)
|
||||
* RPC Name: bridge
|
||||
*
|
||||
* Immutable wrapper around SLE providing type-safe field access.
|
||||
* Use BridgeBuilder to construct new ledger entries.
|
||||
*/
|
||||
class Bridge : public LedgerEntryBase
|
||||
{
|
||||
public:
|
||||
static constexpr LedgerEntryType entryType = ltBRIDGE;
|
||||
|
||||
/**
|
||||
* Construct a Bridge ledger entry wrapper from an existing SLE object.
|
||||
* @throws std::runtime_error if the ledger entry type doesn't match.
|
||||
*/
|
||||
explicit Bridge(SLE const& sle)
|
||||
: LedgerEntryBase(sle)
|
||||
{
|
||||
// Verify ledger entry type
|
||||
if (sle.getType() != entryType)
|
||||
{
|
||||
throw std::runtime_error("Invalid ledger entry type for Bridge");
|
||||
}
|
||||
}
|
||||
|
||||
// Ledger entry-specific field getters
|
||||
|
||||
/**
|
||||
* Get sfAccount (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_ACCOUNT::type::value_type
|
||||
getAccount() const
|
||||
{
|
||||
return this->sle_.at(sfAccount);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfSignatureReward (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_AMOUNT::type::value_type
|
||||
getSignatureReward() const
|
||||
{
|
||||
return this->sle_.at(sfSignatureReward);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfMinAccountCreateAmount (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_AMOUNT::type::value_type>
|
||||
getMinAccountCreateAmount() const
|
||||
{
|
||||
if (hasMinAccountCreateAmount())
|
||||
return this->sle_.at(sfMinAccountCreateAmount);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasMinAccountCreateAmount() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfMinAccountCreateAmount);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfXChainBridge (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_XCHAIN_BRIDGE::type::value_type
|
||||
getXChainBridge() const
|
||||
{
|
||||
return this->sle_.at(sfXChainBridge);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfXChainClaimID (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT64::type::value_type
|
||||
getXChainClaimID() const
|
||||
{
|
||||
return this->sle_.at(sfXChainClaimID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfXChainAccountCreateCount (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT64::type::value_type
|
||||
getXChainAccountCreateCount() const
|
||||
{
|
||||
return this->sle_.at(sfXChainAccountCreateCount);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfXChainAccountClaimCount (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT64::type::value_type
|
||||
getXChainAccountClaimCount() const
|
||||
{
|
||||
return this->sle_.at(sfXChainAccountClaimCount);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfOwnerNode (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT64::type::value_type
|
||||
getOwnerNode() const
|
||||
{
|
||||
return this->sle_.at(sfOwnerNode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfPreviousTxnID (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT256::type::value_type
|
||||
getPreviousTxnID() const
|
||||
{
|
||||
return this->sle_.at(sfPreviousTxnID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfPreviousTxnLgrSeq (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT32::type::value_type
|
||||
getPreviousTxnLgrSeq() const
|
||||
{
|
||||
return this->sle_.at(sfPreviousTxnLgrSeq);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Builder for Bridge ledger entries.
|
||||
* Provides a fluent interface for constructing ledger entries with method chaining.
|
||||
* Uses Json::Value internally for flexible ledger entry construction.
|
||||
* Inherits common field setters from LedgerEntryBuilderBase.
|
||||
*/
|
||||
class BridgeBuilder : public LedgerEntryBuilderBase<BridgeBuilder>
|
||||
{
|
||||
public:
|
||||
BridgeBuilder(std::decay_t<typename SF_ACCOUNT::type::value_type> const& account,std::decay_t<typename SF_AMOUNT::type::value_type> const& signatureReward,std::decay_t<typename SF_XCHAIN_BRIDGE::type::value_type> const& xChainBridge,std::decay_t<typename SF_UINT64::type::value_type> const& xChainClaimID,std::decay_t<typename SF_UINT64::type::value_type> const& xChainAccountCreateCount,std::decay_t<typename SF_UINT64::type::value_type> const& xChainAccountClaimCount,std::decay_t<typename SF_UINT64::type::value_type> const& ownerNode,std::decay_t<typename SF_UINT256::type::value_type> const& previousTxnID,std::decay_t<typename SF_UINT32::type::value_type> const& previousTxnLgrSeq)
|
||||
: LedgerEntryBuilderBase<BridgeBuilder>(ltBRIDGE)
|
||||
{
|
||||
setAccount(account);
|
||||
setSignatureReward(signatureReward);
|
||||
setXChainBridge(xChainBridge);
|
||||
setXChainClaimID(xChainClaimID);
|
||||
setXChainAccountCreateCount(xChainAccountCreateCount);
|
||||
setXChainAccountClaimCount(xChainAccountClaimCount);
|
||||
setOwnerNode(ownerNode);
|
||||
setPreviousTxnID(previousTxnID);
|
||||
setPreviousTxnLgrSeq(previousTxnLgrSeq);
|
||||
}
|
||||
|
||||
BridgeBuilder(SLE const& sle)
|
||||
{
|
||||
if (sle[sfLedgerEntryType] != ltBRIDGE)
|
||||
{
|
||||
throw std::runtime_error("Invalid ledger entry type for Bridge");
|
||||
}
|
||||
object_ = sle;
|
||||
}
|
||||
|
||||
// Ledger entry-specific field setters
|
||||
|
||||
/**
|
||||
* Set sfAccount (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
BridgeBuilder&
|
||||
setAccount(std::decay_t<typename SF_ACCOUNT::type::value_type> const& value)
|
||||
{
|
||||
object_[sfAccount] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfSignatureReward (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
BridgeBuilder&
|
||||
setSignatureReward(std::decay_t<typename SF_AMOUNT::type::value_type> const& value)
|
||||
{
|
||||
object_[sfSignatureReward] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfMinAccountCreateAmount (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
BridgeBuilder&
|
||||
setMinAccountCreateAmount(std::decay_t<typename SF_AMOUNT::type::value_type> const& value)
|
||||
{
|
||||
object_[sfMinAccountCreateAmount] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfXChainBridge (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
BridgeBuilder&
|
||||
setXChainBridge(std::decay_t<typename SF_XCHAIN_BRIDGE::type::value_type> const& value)
|
||||
{
|
||||
object_[sfXChainBridge] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfXChainClaimID (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
BridgeBuilder&
|
||||
setXChainClaimID(std::decay_t<typename SF_UINT64::type::value_type> const& value)
|
||||
{
|
||||
object_[sfXChainClaimID] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfXChainAccountCreateCount (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
BridgeBuilder&
|
||||
setXChainAccountCreateCount(std::decay_t<typename SF_UINT64::type::value_type> const& value)
|
||||
{
|
||||
object_[sfXChainAccountCreateCount] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfXChainAccountClaimCount (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
BridgeBuilder&
|
||||
setXChainAccountClaimCount(std::decay_t<typename SF_UINT64::type::value_type> const& value)
|
||||
{
|
||||
object_[sfXChainAccountClaimCount] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfOwnerNode (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
BridgeBuilder&
|
||||
setOwnerNode(std::decay_t<typename SF_UINT64::type::value_type> const& value)
|
||||
{
|
||||
object_[sfOwnerNode] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfPreviousTxnID (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
BridgeBuilder&
|
||||
setPreviousTxnID(std::decay_t<typename SF_UINT256::type::value_type> const& value)
|
||||
{
|
||||
object_[sfPreviousTxnID] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfPreviousTxnLgrSeq (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
BridgeBuilder&
|
||||
setPreviousTxnLgrSeq(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfPreviousTxnLgrSeq] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build and return the completed Bridge wrapper.
|
||||
* @return The constructed ledger entry wrapper.
|
||||
* @throws std::runtime_error if the JSON cannot be parsed into a valid ledger entry.
|
||||
*/
|
||||
Bridge
|
||||
build(uint256 const& index)
|
||||
{
|
||||
return Bridge{SLE(object_, index)};
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::ledger_entries
|
||||
@@ -1,381 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STLedgerEntry.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/LedgerEntryBase.h>
|
||||
#include <xrpl/protocol_autogen/LedgerEntryBuilderBase.h>
|
||||
#include <xrpl/json/json_value.h>
|
||||
|
||||
#include <stdexcept>
|
||||
#include <optional>
|
||||
|
||||
namespace xrpl::ledger_entries {
|
||||
|
||||
// Forward declaration
|
||||
class CheckBuilder;
|
||||
|
||||
/**
|
||||
* Ledger Entry: Check
|
||||
* Type: ltCHECK (0x0043)
|
||||
* RPC Name: check
|
||||
*
|
||||
* Immutable wrapper around SLE providing type-safe field access.
|
||||
* Use CheckBuilder to construct new ledger entries.
|
||||
*/
|
||||
class Check : public LedgerEntryBase
|
||||
{
|
||||
public:
|
||||
static constexpr LedgerEntryType entryType = ltCHECK;
|
||||
|
||||
/**
|
||||
* Construct a Check ledger entry wrapper from an existing SLE object.
|
||||
* @throws std::runtime_error if the ledger entry type doesn't match.
|
||||
*/
|
||||
explicit Check(SLE const& sle)
|
||||
: LedgerEntryBase(sle)
|
||||
{
|
||||
// Verify ledger entry type
|
||||
if (sle.getType() != entryType)
|
||||
{
|
||||
throw std::runtime_error("Invalid ledger entry type for Check");
|
||||
}
|
||||
}
|
||||
|
||||
// Ledger entry-specific field getters
|
||||
|
||||
/**
|
||||
* Get sfAccount (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_ACCOUNT::type::value_type
|
||||
getAccount() const
|
||||
{
|
||||
return this->sle_.at(sfAccount);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfDestination (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_ACCOUNT::type::value_type
|
||||
getDestination() const
|
||||
{
|
||||
return this->sle_.at(sfDestination);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfSendMax (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_AMOUNT::type::value_type
|
||||
getSendMax() const
|
||||
{
|
||||
return this->sle_.at(sfSendMax);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfSequence (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT32::type::value_type
|
||||
getSequence() const
|
||||
{
|
||||
return this->sle_.at(sfSequence);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfOwnerNode (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT64::type::value_type
|
||||
getOwnerNode() const
|
||||
{
|
||||
return this->sle_.at(sfOwnerNode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfDestinationNode (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT64::type::value_type
|
||||
getDestinationNode() const
|
||||
{
|
||||
return this->sle_.at(sfDestinationNode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfExpiration (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT32::type::value_type>
|
||||
getExpiration() const
|
||||
{
|
||||
if (hasExpiration())
|
||||
return this->sle_.at(sfExpiration);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasExpiration() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfExpiration);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfInvoiceID (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT256::type::value_type>
|
||||
getInvoiceID() const
|
||||
{
|
||||
if (hasInvoiceID())
|
||||
return this->sle_.at(sfInvoiceID);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasInvoiceID() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfInvoiceID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfSourceTag (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT32::type::value_type>
|
||||
getSourceTag() const
|
||||
{
|
||||
if (hasSourceTag())
|
||||
return this->sle_.at(sfSourceTag);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasSourceTag() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfSourceTag);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfDestinationTag (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT32::type::value_type>
|
||||
getDestinationTag() const
|
||||
{
|
||||
if (hasDestinationTag())
|
||||
return this->sle_.at(sfDestinationTag);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasDestinationTag() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfDestinationTag);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfPreviousTxnID (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT256::type::value_type
|
||||
getPreviousTxnID() const
|
||||
{
|
||||
return this->sle_.at(sfPreviousTxnID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfPreviousTxnLgrSeq (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT32::type::value_type
|
||||
getPreviousTxnLgrSeq() const
|
||||
{
|
||||
return this->sle_.at(sfPreviousTxnLgrSeq);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Builder for Check ledger entries.
|
||||
* Provides a fluent interface for constructing ledger entries with method chaining.
|
||||
* Uses Json::Value internally for flexible ledger entry construction.
|
||||
* Inherits common field setters from LedgerEntryBuilderBase.
|
||||
*/
|
||||
class CheckBuilder : public LedgerEntryBuilderBase<CheckBuilder>
|
||||
{
|
||||
public:
|
||||
CheckBuilder(std::decay_t<typename SF_ACCOUNT::type::value_type> const& account,std::decay_t<typename SF_ACCOUNT::type::value_type> const& destination,std::decay_t<typename SF_AMOUNT::type::value_type> const& sendMax,std::decay_t<typename SF_UINT32::type::value_type> const& sequence,std::decay_t<typename SF_UINT64::type::value_type> const& ownerNode,std::decay_t<typename SF_UINT64::type::value_type> const& destinationNode,std::decay_t<typename SF_UINT256::type::value_type> const& previousTxnID,std::decay_t<typename SF_UINT32::type::value_type> const& previousTxnLgrSeq)
|
||||
: LedgerEntryBuilderBase<CheckBuilder>(ltCHECK)
|
||||
{
|
||||
setAccount(account);
|
||||
setDestination(destination);
|
||||
setSendMax(sendMax);
|
||||
setSequence(sequence);
|
||||
setOwnerNode(ownerNode);
|
||||
setDestinationNode(destinationNode);
|
||||
setPreviousTxnID(previousTxnID);
|
||||
setPreviousTxnLgrSeq(previousTxnLgrSeq);
|
||||
}
|
||||
|
||||
CheckBuilder(SLE const& sle)
|
||||
{
|
||||
if (sle[sfLedgerEntryType] != ltCHECK)
|
||||
{
|
||||
throw std::runtime_error("Invalid ledger entry type for Check");
|
||||
}
|
||||
object_ = sle;
|
||||
}
|
||||
|
||||
// Ledger entry-specific field setters
|
||||
|
||||
/**
|
||||
* Set sfAccount (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
CheckBuilder&
|
||||
setAccount(std::decay_t<typename SF_ACCOUNT::type::value_type> const& value)
|
||||
{
|
||||
object_[sfAccount] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfDestination (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
CheckBuilder&
|
||||
setDestination(std::decay_t<typename SF_ACCOUNT::type::value_type> const& value)
|
||||
{
|
||||
object_[sfDestination] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfSendMax (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
CheckBuilder&
|
||||
setSendMax(std::decay_t<typename SF_AMOUNT::type::value_type> const& value)
|
||||
{
|
||||
object_[sfSendMax] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfSequence (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
CheckBuilder&
|
||||
setSequence(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfSequence] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfOwnerNode (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
CheckBuilder&
|
||||
setOwnerNode(std::decay_t<typename SF_UINT64::type::value_type> const& value)
|
||||
{
|
||||
object_[sfOwnerNode] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfDestinationNode (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
CheckBuilder&
|
||||
setDestinationNode(std::decay_t<typename SF_UINT64::type::value_type> const& value)
|
||||
{
|
||||
object_[sfDestinationNode] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfExpiration (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
CheckBuilder&
|
||||
setExpiration(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfExpiration] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfInvoiceID (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
CheckBuilder&
|
||||
setInvoiceID(std::decay_t<typename SF_UINT256::type::value_type> const& value)
|
||||
{
|
||||
object_[sfInvoiceID] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfSourceTag (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
CheckBuilder&
|
||||
setSourceTag(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfSourceTag] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfDestinationTag (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
CheckBuilder&
|
||||
setDestinationTag(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfDestinationTag] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfPreviousTxnID (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
CheckBuilder&
|
||||
setPreviousTxnID(std::decay_t<typename SF_UINT256::type::value_type> const& value)
|
||||
{
|
||||
object_[sfPreviousTxnID] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfPreviousTxnLgrSeq (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
CheckBuilder&
|
||||
setPreviousTxnLgrSeq(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfPreviousTxnLgrSeq] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build and return the completed Check wrapper.
|
||||
* @return The constructed ledger entry wrapper.
|
||||
* @throws std::runtime_error if the JSON cannot be parsed into a valid ledger entry.
|
||||
*/
|
||||
Check
|
||||
build(uint256 const& index)
|
||||
{
|
||||
return Check{SLE(object_, index)};
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::ledger_entries
|
||||
@@ -1,307 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STLedgerEntry.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/LedgerEntryBase.h>
|
||||
#include <xrpl/protocol_autogen/LedgerEntryBuilderBase.h>
|
||||
#include <xrpl/json/json_value.h>
|
||||
|
||||
#include <stdexcept>
|
||||
#include <optional>
|
||||
|
||||
namespace xrpl::ledger_entries {
|
||||
|
||||
// Forward declaration
|
||||
class CredentialBuilder;
|
||||
|
||||
/**
|
||||
* Ledger Entry: Credential
|
||||
* Type: ltCREDENTIAL (0x0081)
|
||||
* RPC Name: credential
|
||||
*
|
||||
* Immutable wrapper around SLE providing type-safe field access.
|
||||
* Use CredentialBuilder to construct new ledger entries.
|
||||
*/
|
||||
class Credential : public LedgerEntryBase
|
||||
{
|
||||
public:
|
||||
static constexpr LedgerEntryType entryType = ltCREDENTIAL;
|
||||
|
||||
/**
|
||||
* Construct a Credential ledger entry wrapper from an existing SLE object.
|
||||
* @throws std::runtime_error if the ledger entry type doesn't match.
|
||||
*/
|
||||
explicit Credential(SLE const& sle)
|
||||
: LedgerEntryBase(sle)
|
||||
{
|
||||
// Verify ledger entry type
|
||||
if (sle.getType() != entryType)
|
||||
{
|
||||
throw std::runtime_error("Invalid ledger entry type for Credential");
|
||||
}
|
||||
}
|
||||
|
||||
// Ledger entry-specific field getters
|
||||
|
||||
/**
|
||||
* Get sfSubject (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_ACCOUNT::type::value_type
|
||||
getSubject() const
|
||||
{
|
||||
return this->sle_.at(sfSubject);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfIssuer (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_ACCOUNT::type::value_type
|
||||
getIssuer() const
|
||||
{
|
||||
return this->sle_.at(sfIssuer);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfCredentialType (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_VL::type::value_type
|
||||
getCredentialType() const
|
||||
{
|
||||
return this->sle_.at(sfCredentialType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfExpiration (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT32::type::value_type>
|
||||
getExpiration() const
|
||||
{
|
||||
if (hasExpiration())
|
||||
return this->sle_.at(sfExpiration);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasExpiration() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfExpiration);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfURI (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_VL::type::value_type>
|
||||
getURI() const
|
||||
{
|
||||
if (hasURI())
|
||||
return this->sle_.at(sfURI);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasURI() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfURI);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfIssuerNode (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT64::type::value_type
|
||||
getIssuerNode() const
|
||||
{
|
||||
return this->sle_.at(sfIssuerNode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfSubjectNode (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT64::type::value_type>
|
||||
getSubjectNode() const
|
||||
{
|
||||
if (hasSubjectNode())
|
||||
return this->sle_.at(sfSubjectNode);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasSubjectNode() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfSubjectNode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfPreviousTxnID (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT256::type::value_type
|
||||
getPreviousTxnID() const
|
||||
{
|
||||
return this->sle_.at(sfPreviousTxnID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfPreviousTxnLgrSeq (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT32::type::value_type
|
||||
getPreviousTxnLgrSeq() const
|
||||
{
|
||||
return this->sle_.at(sfPreviousTxnLgrSeq);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Builder for Credential ledger entries.
|
||||
* Provides a fluent interface for constructing ledger entries with method chaining.
|
||||
* Uses Json::Value internally for flexible ledger entry construction.
|
||||
* Inherits common field setters from LedgerEntryBuilderBase.
|
||||
*/
|
||||
class CredentialBuilder : public LedgerEntryBuilderBase<CredentialBuilder>
|
||||
{
|
||||
public:
|
||||
CredentialBuilder(std::decay_t<typename SF_ACCOUNT::type::value_type> const& subject,std::decay_t<typename SF_ACCOUNT::type::value_type> const& issuer,std::decay_t<typename SF_VL::type::value_type> const& credentialType,std::decay_t<typename SF_UINT64::type::value_type> const& issuerNode,std::decay_t<typename SF_UINT256::type::value_type> const& previousTxnID,std::decay_t<typename SF_UINT32::type::value_type> const& previousTxnLgrSeq)
|
||||
: LedgerEntryBuilderBase<CredentialBuilder>(ltCREDENTIAL)
|
||||
{
|
||||
setSubject(subject);
|
||||
setIssuer(issuer);
|
||||
setCredentialType(credentialType);
|
||||
setIssuerNode(issuerNode);
|
||||
setPreviousTxnID(previousTxnID);
|
||||
setPreviousTxnLgrSeq(previousTxnLgrSeq);
|
||||
}
|
||||
|
||||
CredentialBuilder(SLE const& sle)
|
||||
{
|
||||
if (sle[sfLedgerEntryType] != ltCREDENTIAL)
|
||||
{
|
||||
throw std::runtime_error("Invalid ledger entry type for Credential");
|
||||
}
|
||||
object_ = sle;
|
||||
}
|
||||
|
||||
// Ledger entry-specific field setters
|
||||
|
||||
/**
|
||||
* Set sfSubject (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
CredentialBuilder&
|
||||
setSubject(std::decay_t<typename SF_ACCOUNT::type::value_type> const& value)
|
||||
{
|
||||
object_[sfSubject] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfIssuer (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
CredentialBuilder&
|
||||
setIssuer(std::decay_t<typename SF_ACCOUNT::type::value_type> const& value)
|
||||
{
|
||||
object_[sfIssuer] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfCredentialType (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
CredentialBuilder&
|
||||
setCredentialType(std::decay_t<typename SF_VL::type::value_type> const& value)
|
||||
{
|
||||
object_[sfCredentialType] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfExpiration (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
CredentialBuilder&
|
||||
setExpiration(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfExpiration] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfURI (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
CredentialBuilder&
|
||||
setURI(std::decay_t<typename SF_VL::type::value_type> const& value)
|
||||
{
|
||||
object_[sfURI] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfIssuerNode (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
CredentialBuilder&
|
||||
setIssuerNode(std::decay_t<typename SF_UINT64::type::value_type> const& value)
|
||||
{
|
||||
object_[sfIssuerNode] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfSubjectNode (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
CredentialBuilder&
|
||||
setSubjectNode(std::decay_t<typename SF_UINT64::type::value_type> const& value)
|
||||
{
|
||||
object_[sfSubjectNode] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfPreviousTxnID (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
CredentialBuilder&
|
||||
setPreviousTxnID(std::decay_t<typename SF_UINT256::type::value_type> const& value)
|
||||
{
|
||||
object_[sfPreviousTxnID] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfPreviousTxnLgrSeq (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
CredentialBuilder&
|
||||
setPreviousTxnLgrSeq(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfPreviousTxnLgrSeq] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build and return the completed Credential wrapper.
|
||||
* @return The constructed ledger entry wrapper.
|
||||
* @throws std::runtime_error if the JSON cannot be parsed into a valid ledger entry.
|
||||
*/
|
||||
Credential
|
||||
build(uint256 const& index)
|
||||
{
|
||||
return Credential{SLE(object_, index)};
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::ledger_entries
|
||||
@@ -1,263 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STLedgerEntry.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/LedgerEntryBase.h>
|
||||
#include <xrpl/protocol_autogen/LedgerEntryBuilderBase.h>
|
||||
#include <xrpl/json/json_value.h>
|
||||
|
||||
#include <stdexcept>
|
||||
#include <optional>
|
||||
|
||||
namespace xrpl::ledger_entries {
|
||||
|
||||
// Forward declaration
|
||||
class DIDBuilder;
|
||||
|
||||
/**
|
||||
* Ledger Entry: DID
|
||||
* Type: ltDID (0x0049)
|
||||
* RPC Name: did
|
||||
*
|
||||
* Immutable wrapper around SLE providing type-safe field access.
|
||||
* Use DIDBuilder to construct new ledger entries.
|
||||
*/
|
||||
class DID : public LedgerEntryBase
|
||||
{
|
||||
public:
|
||||
static constexpr LedgerEntryType entryType = ltDID;
|
||||
|
||||
/**
|
||||
* Construct a DID ledger entry wrapper from an existing SLE object.
|
||||
* @throws std::runtime_error if the ledger entry type doesn't match.
|
||||
*/
|
||||
explicit DID(SLE const& sle)
|
||||
: LedgerEntryBase(sle)
|
||||
{
|
||||
// Verify ledger entry type
|
||||
if (sle.getType() != entryType)
|
||||
{
|
||||
throw std::runtime_error("Invalid ledger entry type for DID");
|
||||
}
|
||||
}
|
||||
|
||||
// Ledger entry-specific field getters
|
||||
|
||||
/**
|
||||
* Get sfAccount (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_ACCOUNT::type::value_type
|
||||
getAccount() const
|
||||
{
|
||||
return this->sle_.at(sfAccount);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfDIDDocument (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_VL::type::value_type>
|
||||
getDIDDocument() const
|
||||
{
|
||||
if (hasDIDDocument())
|
||||
return this->sle_.at(sfDIDDocument);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasDIDDocument() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfDIDDocument);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfURI (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_VL::type::value_type>
|
||||
getURI() const
|
||||
{
|
||||
if (hasURI())
|
||||
return this->sle_.at(sfURI);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasURI() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfURI);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfData (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_VL::type::value_type>
|
||||
getData() const
|
||||
{
|
||||
if (hasData())
|
||||
return this->sle_.at(sfData);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasData() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfData);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfOwnerNode (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT64::type::value_type
|
||||
getOwnerNode() const
|
||||
{
|
||||
return this->sle_.at(sfOwnerNode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfPreviousTxnID (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT256::type::value_type
|
||||
getPreviousTxnID() const
|
||||
{
|
||||
return this->sle_.at(sfPreviousTxnID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfPreviousTxnLgrSeq (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT32::type::value_type
|
||||
getPreviousTxnLgrSeq() const
|
||||
{
|
||||
return this->sle_.at(sfPreviousTxnLgrSeq);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Builder for DID ledger entries.
|
||||
* Provides a fluent interface for constructing ledger entries with method chaining.
|
||||
* Uses Json::Value internally for flexible ledger entry construction.
|
||||
* Inherits common field setters from LedgerEntryBuilderBase.
|
||||
*/
|
||||
class DIDBuilder : public LedgerEntryBuilderBase<DIDBuilder>
|
||||
{
|
||||
public:
|
||||
DIDBuilder(std::decay_t<typename SF_ACCOUNT::type::value_type> const& account,std::decay_t<typename SF_UINT64::type::value_type> const& ownerNode,std::decay_t<typename SF_UINT256::type::value_type> const& previousTxnID,std::decay_t<typename SF_UINT32::type::value_type> const& previousTxnLgrSeq)
|
||||
: LedgerEntryBuilderBase<DIDBuilder>(ltDID)
|
||||
{
|
||||
setAccount(account);
|
||||
setOwnerNode(ownerNode);
|
||||
setPreviousTxnID(previousTxnID);
|
||||
setPreviousTxnLgrSeq(previousTxnLgrSeq);
|
||||
}
|
||||
|
||||
DIDBuilder(SLE const& sle)
|
||||
{
|
||||
if (sle[sfLedgerEntryType] != ltDID)
|
||||
{
|
||||
throw std::runtime_error("Invalid ledger entry type for DID");
|
||||
}
|
||||
object_ = sle;
|
||||
}
|
||||
|
||||
// Ledger entry-specific field setters
|
||||
|
||||
/**
|
||||
* Set sfAccount (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
DIDBuilder&
|
||||
setAccount(std::decay_t<typename SF_ACCOUNT::type::value_type> const& value)
|
||||
{
|
||||
object_[sfAccount] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfDIDDocument (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
DIDBuilder&
|
||||
setDIDDocument(std::decay_t<typename SF_VL::type::value_type> const& value)
|
||||
{
|
||||
object_[sfDIDDocument] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfURI (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
DIDBuilder&
|
||||
setURI(std::decay_t<typename SF_VL::type::value_type> const& value)
|
||||
{
|
||||
object_[sfURI] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfData (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
DIDBuilder&
|
||||
setData(std::decay_t<typename SF_VL::type::value_type> const& value)
|
||||
{
|
||||
object_[sfData] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfOwnerNode (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
DIDBuilder&
|
||||
setOwnerNode(std::decay_t<typename SF_UINT64::type::value_type> const& value)
|
||||
{
|
||||
object_[sfOwnerNode] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfPreviousTxnID (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
DIDBuilder&
|
||||
setPreviousTxnID(std::decay_t<typename SF_UINT256::type::value_type> const& value)
|
||||
{
|
||||
object_[sfPreviousTxnID] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfPreviousTxnLgrSeq (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
DIDBuilder&
|
||||
setPreviousTxnLgrSeq(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfPreviousTxnLgrSeq] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build and return the completed DID wrapper.
|
||||
* @return The constructed ledger entry wrapper.
|
||||
* @throws std::runtime_error if the JSON cannot be parsed into a valid ledger entry.
|
||||
*/
|
||||
DID
|
||||
build(uint256 const& index)
|
||||
{
|
||||
return DID{SLE(object_, index)};
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::ledger_entries
|
||||
@@ -1,218 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STLedgerEntry.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/LedgerEntryBase.h>
|
||||
#include <xrpl/protocol_autogen/LedgerEntryBuilderBase.h>
|
||||
#include <xrpl/json/json_value.h>
|
||||
|
||||
#include <stdexcept>
|
||||
#include <optional>
|
||||
|
||||
namespace xrpl::ledger_entries {
|
||||
|
||||
// Forward declaration
|
||||
class DelegateBuilder;
|
||||
|
||||
/**
|
||||
* Ledger Entry: Delegate
|
||||
* Type: ltDELEGATE (0x0083)
|
||||
* RPC Name: delegate
|
||||
*
|
||||
* Immutable wrapper around SLE providing type-safe field access.
|
||||
* Use DelegateBuilder to construct new ledger entries.
|
||||
*/
|
||||
class Delegate : public LedgerEntryBase
|
||||
{
|
||||
public:
|
||||
static constexpr LedgerEntryType entryType = ltDELEGATE;
|
||||
|
||||
/**
|
||||
* Construct a Delegate ledger entry wrapper from an existing SLE object.
|
||||
* @throws std::runtime_error if the ledger entry type doesn't match.
|
||||
*/
|
||||
explicit Delegate(SLE const& sle)
|
||||
: LedgerEntryBase(sle)
|
||||
{
|
||||
// Verify ledger entry type
|
||||
if (sle.getType() != entryType)
|
||||
{
|
||||
throw std::runtime_error("Invalid ledger entry type for Delegate");
|
||||
}
|
||||
}
|
||||
|
||||
// Ledger entry-specific field getters
|
||||
|
||||
/**
|
||||
* Get sfAccount (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_ACCOUNT::type::value_type
|
||||
getAccount() const
|
||||
{
|
||||
return this->sle_.at(sfAccount);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfAuthorize (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_ACCOUNT::type::value_type
|
||||
getAuthorize() const
|
||||
{
|
||||
return this->sle_.at(sfAuthorize);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfPermissions (soeREQUIRED)
|
||||
* Note: This is an untyped field (unknown).
|
||||
*/
|
||||
[[nodiscard]]
|
||||
STArray const&
|
||||
getPermissions() const
|
||||
{
|
||||
return this->sle_.getFieldArray(sfPermissions);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfOwnerNode (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT64::type::value_type
|
||||
getOwnerNode() const
|
||||
{
|
||||
return this->sle_.at(sfOwnerNode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfPreviousTxnID (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT256::type::value_type
|
||||
getPreviousTxnID() const
|
||||
{
|
||||
return this->sle_.at(sfPreviousTxnID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfPreviousTxnLgrSeq (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT32::type::value_type
|
||||
getPreviousTxnLgrSeq() const
|
||||
{
|
||||
return this->sle_.at(sfPreviousTxnLgrSeq);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Builder for Delegate ledger entries.
|
||||
* Provides a fluent interface for constructing ledger entries with method chaining.
|
||||
* Uses Json::Value internally for flexible ledger entry construction.
|
||||
* Inherits common field setters from LedgerEntryBuilderBase.
|
||||
*/
|
||||
class DelegateBuilder : public LedgerEntryBuilderBase<DelegateBuilder>
|
||||
{
|
||||
public:
|
||||
DelegateBuilder(std::decay_t<typename SF_ACCOUNT::type::value_type> const& account,std::decay_t<typename SF_ACCOUNT::type::value_type> const& authorize,STArray const& permissions,std::decay_t<typename SF_UINT64::type::value_type> const& ownerNode,std::decay_t<typename SF_UINT256::type::value_type> const& previousTxnID,std::decay_t<typename SF_UINT32::type::value_type> const& previousTxnLgrSeq)
|
||||
: LedgerEntryBuilderBase<DelegateBuilder>(ltDELEGATE)
|
||||
{
|
||||
setAccount(account);
|
||||
setAuthorize(authorize);
|
||||
setPermissions(permissions);
|
||||
setOwnerNode(ownerNode);
|
||||
setPreviousTxnID(previousTxnID);
|
||||
setPreviousTxnLgrSeq(previousTxnLgrSeq);
|
||||
}
|
||||
|
||||
DelegateBuilder(SLE const& sle)
|
||||
{
|
||||
if (sle[sfLedgerEntryType] != ltDELEGATE)
|
||||
{
|
||||
throw std::runtime_error("Invalid ledger entry type for Delegate");
|
||||
}
|
||||
object_ = sle;
|
||||
}
|
||||
|
||||
// Ledger entry-specific field setters
|
||||
|
||||
/**
|
||||
* Set sfAccount (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
DelegateBuilder&
|
||||
setAccount(std::decay_t<typename SF_ACCOUNT::type::value_type> const& value)
|
||||
{
|
||||
object_[sfAccount] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfAuthorize (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
DelegateBuilder&
|
||||
setAuthorize(std::decay_t<typename SF_ACCOUNT::type::value_type> const& value)
|
||||
{
|
||||
object_[sfAuthorize] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfPermissions (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
DelegateBuilder&
|
||||
setPermissions(STArray const& value)
|
||||
{
|
||||
object_.setFieldArray(sfPermissions, value);
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfOwnerNode (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
DelegateBuilder&
|
||||
setOwnerNode(std::decay_t<typename SF_UINT64::type::value_type> const& value)
|
||||
{
|
||||
object_[sfOwnerNode] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfPreviousTxnID (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
DelegateBuilder&
|
||||
setPreviousTxnID(std::decay_t<typename SF_UINT256::type::value_type> const& value)
|
||||
{
|
||||
object_[sfPreviousTxnID] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfPreviousTxnLgrSeq (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
DelegateBuilder&
|
||||
setPreviousTxnLgrSeq(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfPreviousTxnLgrSeq] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build and return the completed Delegate wrapper.
|
||||
* @return The constructed ledger entry wrapper.
|
||||
* @throws std::runtime_error if the JSON cannot be parsed into a valid ledger entry.
|
||||
*/
|
||||
Delegate
|
||||
build(uint256 const& index)
|
||||
{
|
||||
return Delegate{SLE(object_, index)};
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::ledger_entries
|
||||
@@ -1,234 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STLedgerEntry.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/LedgerEntryBase.h>
|
||||
#include <xrpl/protocol_autogen/LedgerEntryBuilderBase.h>
|
||||
#include <xrpl/json/json_value.h>
|
||||
|
||||
#include <stdexcept>
|
||||
#include <optional>
|
||||
|
||||
namespace xrpl::ledger_entries {
|
||||
|
||||
// Forward declaration
|
||||
class DepositPreauthBuilder;
|
||||
|
||||
/**
|
||||
* Ledger Entry: DepositPreauth
|
||||
* Type: ltDEPOSIT_PREAUTH (0x0070)
|
||||
* RPC Name: deposit_preauth
|
||||
*
|
||||
* Immutable wrapper around SLE providing type-safe field access.
|
||||
* Use DepositPreauthBuilder to construct new ledger entries.
|
||||
*/
|
||||
class DepositPreauth : public LedgerEntryBase
|
||||
{
|
||||
public:
|
||||
static constexpr LedgerEntryType entryType = ltDEPOSIT_PREAUTH;
|
||||
|
||||
/**
|
||||
* Construct a DepositPreauth ledger entry wrapper from an existing SLE object.
|
||||
* @throws std::runtime_error if the ledger entry type doesn't match.
|
||||
*/
|
||||
explicit DepositPreauth(SLE const& sle)
|
||||
: LedgerEntryBase(sle)
|
||||
{
|
||||
// Verify ledger entry type
|
||||
if (sle.getType() != entryType)
|
||||
{
|
||||
throw std::runtime_error("Invalid ledger entry type for DepositPreauth");
|
||||
}
|
||||
}
|
||||
|
||||
// Ledger entry-specific field getters
|
||||
|
||||
/**
|
||||
* Get sfAccount (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_ACCOUNT::type::value_type
|
||||
getAccount() const
|
||||
{
|
||||
return this->sle_.at(sfAccount);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfAuthorize (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_ACCOUNT::type::value_type>
|
||||
getAuthorize() const
|
||||
{
|
||||
if (hasAuthorize())
|
||||
return this->sle_.at(sfAuthorize);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasAuthorize() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfAuthorize);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfOwnerNode (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT64::type::value_type
|
||||
getOwnerNode() const
|
||||
{
|
||||
return this->sle_.at(sfOwnerNode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfPreviousTxnID (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT256::type::value_type
|
||||
getPreviousTxnID() const
|
||||
{
|
||||
return this->sle_.at(sfPreviousTxnID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfPreviousTxnLgrSeq (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT32::type::value_type
|
||||
getPreviousTxnLgrSeq() const
|
||||
{
|
||||
return this->sle_.at(sfPreviousTxnLgrSeq);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfAuthorizeCredentials (soeOPTIONAL)
|
||||
* Note: This is an untyped field (unknown).
|
||||
*/
|
||||
[[nodiscard]]
|
||||
std::optional<std::reference_wrapper<STArray const>>
|
||||
getAuthorizeCredentials() const
|
||||
{
|
||||
if (this->sle_.isFieldPresent(sfAuthorizeCredentials))
|
||||
return this->sle_.getFieldArray(sfAuthorizeCredentials);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasAuthorizeCredentials() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfAuthorizeCredentials);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Builder for DepositPreauth ledger entries.
|
||||
* Provides a fluent interface for constructing ledger entries with method chaining.
|
||||
* Uses Json::Value internally for flexible ledger entry construction.
|
||||
* Inherits common field setters from LedgerEntryBuilderBase.
|
||||
*/
|
||||
class DepositPreauthBuilder : public LedgerEntryBuilderBase<DepositPreauthBuilder>
|
||||
{
|
||||
public:
|
||||
DepositPreauthBuilder(std::decay_t<typename SF_ACCOUNT::type::value_type> const& account,std::decay_t<typename SF_UINT64::type::value_type> const& ownerNode,std::decay_t<typename SF_UINT256::type::value_type> const& previousTxnID,std::decay_t<typename SF_UINT32::type::value_type> const& previousTxnLgrSeq)
|
||||
: LedgerEntryBuilderBase<DepositPreauthBuilder>(ltDEPOSIT_PREAUTH)
|
||||
{
|
||||
setAccount(account);
|
||||
setOwnerNode(ownerNode);
|
||||
setPreviousTxnID(previousTxnID);
|
||||
setPreviousTxnLgrSeq(previousTxnLgrSeq);
|
||||
}
|
||||
|
||||
DepositPreauthBuilder(SLE const& sle)
|
||||
{
|
||||
if (sle[sfLedgerEntryType] != ltDEPOSIT_PREAUTH)
|
||||
{
|
||||
throw std::runtime_error("Invalid ledger entry type for DepositPreauth");
|
||||
}
|
||||
object_ = sle;
|
||||
}
|
||||
|
||||
// Ledger entry-specific field setters
|
||||
|
||||
/**
|
||||
* Set sfAccount (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
DepositPreauthBuilder&
|
||||
setAccount(std::decay_t<typename SF_ACCOUNT::type::value_type> const& value)
|
||||
{
|
||||
object_[sfAccount] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfAuthorize (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
DepositPreauthBuilder&
|
||||
setAuthorize(std::decay_t<typename SF_ACCOUNT::type::value_type> const& value)
|
||||
{
|
||||
object_[sfAuthorize] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfOwnerNode (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
DepositPreauthBuilder&
|
||||
setOwnerNode(std::decay_t<typename SF_UINT64::type::value_type> const& value)
|
||||
{
|
||||
object_[sfOwnerNode] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfPreviousTxnID (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
DepositPreauthBuilder&
|
||||
setPreviousTxnID(std::decay_t<typename SF_UINT256::type::value_type> const& value)
|
||||
{
|
||||
object_[sfPreviousTxnID] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfPreviousTxnLgrSeq (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
DepositPreauthBuilder&
|
||||
setPreviousTxnLgrSeq(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfPreviousTxnLgrSeq] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfAuthorizeCredentials (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
DepositPreauthBuilder&
|
||||
setAuthorizeCredentials(STArray const& value)
|
||||
{
|
||||
object_.setFieldArray(sfAuthorizeCredentials, value);
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build and return the completed DepositPreauth wrapper.
|
||||
* @return The constructed ledger entry wrapper.
|
||||
* @throws std::runtime_error if the JSON cannot be parsed into a valid ledger entry.
|
||||
*/
|
||||
DepositPreauth
|
||||
build(uint256 const& index)
|
||||
{
|
||||
return DepositPreauth{SLE(object_, index)};
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::ledger_entries
|
||||
@@ -1,489 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STLedgerEntry.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/LedgerEntryBase.h>
|
||||
#include <xrpl/protocol_autogen/LedgerEntryBuilderBase.h>
|
||||
#include <xrpl/json/json_value.h>
|
||||
|
||||
#include <stdexcept>
|
||||
#include <optional>
|
||||
|
||||
namespace xrpl::ledger_entries {
|
||||
|
||||
// Forward declaration
|
||||
class DirectoryNodeBuilder;
|
||||
|
||||
/**
|
||||
* Ledger Entry: DirectoryNode
|
||||
* Type: ltDIR_NODE (0x0064)
|
||||
* RPC Name: directory
|
||||
*
|
||||
* Immutable wrapper around SLE providing type-safe field access.
|
||||
* Use DirectoryNodeBuilder to construct new ledger entries.
|
||||
*/
|
||||
class DirectoryNode : public LedgerEntryBase
|
||||
{
|
||||
public:
|
||||
static constexpr LedgerEntryType entryType = ltDIR_NODE;
|
||||
|
||||
/**
|
||||
* Construct a DirectoryNode ledger entry wrapper from an existing SLE object.
|
||||
* @throws std::runtime_error if the ledger entry type doesn't match.
|
||||
*/
|
||||
explicit DirectoryNode(SLE const& sle)
|
||||
: LedgerEntryBase(sle)
|
||||
{
|
||||
// Verify ledger entry type
|
||||
if (sle.getType() != entryType)
|
||||
{
|
||||
throw std::runtime_error("Invalid ledger entry type for DirectoryNode");
|
||||
}
|
||||
}
|
||||
|
||||
// Ledger entry-specific field getters
|
||||
|
||||
/**
|
||||
* Get sfOwner (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_ACCOUNT::type::value_type>
|
||||
getOwner() const
|
||||
{
|
||||
if (hasOwner())
|
||||
return this->sle_.at(sfOwner);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasOwner() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfOwner);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfTakerPaysCurrency (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT160::type::value_type>
|
||||
getTakerPaysCurrency() const
|
||||
{
|
||||
if (hasTakerPaysCurrency())
|
||||
return this->sle_.at(sfTakerPaysCurrency);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasTakerPaysCurrency() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfTakerPaysCurrency);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfTakerPaysIssuer (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT160::type::value_type>
|
||||
getTakerPaysIssuer() const
|
||||
{
|
||||
if (hasTakerPaysIssuer())
|
||||
return this->sle_.at(sfTakerPaysIssuer);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasTakerPaysIssuer() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfTakerPaysIssuer);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfTakerGetsCurrency (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT160::type::value_type>
|
||||
getTakerGetsCurrency() const
|
||||
{
|
||||
if (hasTakerGetsCurrency())
|
||||
return this->sle_.at(sfTakerGetsCurrency);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasTakerGetsCurrency() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfTakerGetsCurrency);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfTakerGetsIssuer (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT160::type::value_type>
|
||||
getTakerGetsIssuer() const
|
||||
{
|
||||
if (hasTakerGetsIssuer())
|
||||
return this->sle_.at(sfTakerGetsIssuer);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasTakerGetsIssuer() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfTakerGetsIssuer);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfExchangeRate (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT64::type::value_type>
|
||||
getExchangeRate() const
|
||||
{
|
||||
if (hasExchangeRate())
|
||||
return this->sle_.at(sfExchangeRate);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasExchangeRate() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfExchangeRate);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfIndexes (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_VECTOR256::type::value_type
|
||||
getIndexes() const
|
||||
{
|
||||
return this->sle_.at(sfIndexes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfRootIndex (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT256::type::value_type
|
||||
getRootIndex() const
|
||||
{
|
||||
return this->sle_.at(sfRootIndex);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfIndexNext (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT64::type::value_type>
|
||||
getIndexNext() const
|
||||
{
|
||||
if (hasIndexNext())
|
||||
return this->sle_.at(sfIndexNext);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasIndexNext() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfIndexNext);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfIndexPrevious (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT64::type::value_type>
|
||||
getIndexPrevious() const
|
||||
{
|
||||
if (hasIndexPrevious())
|
||||
return this->sle_.at(sfIndexPrevious);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasIndexPrevious() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfIndexPrevious);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfNFTokenID (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT256::type::value_type>
|
||||
getNFTokenID() const
|
||||
{
|
||||
if (hasNFTokenID())
|
||||
return this->sle_.at(sfNFTokenID);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasNFTokenID() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfNFTokenID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfPreviousTxnID (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT256::type::value_type>
|
||||
getPreviousTxnID() const
|
||||
{
|
||||
if (hasPreviousTxnID())
|
||||
return this->sle_.at(sfPreviousTxnID);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasPreviousTxnID() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfPreviousTxnID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfPreviousTxnLgrSeq (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT32::type::value_type>
|
||||
getPreviousTxnLgrSeq() const
|
||||
{
|
||||
if (hasPreviousTxnLgrSeq())
|
||||
return this->sle_.at(sfPreviousTxnLgrSeq);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasPreviousTxnLgrSeq() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfPreviousTxnLgrSeq);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfDomainID (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT256::type::value_type>
|
||||
getDomainID() const
|
||||
{
|
||||
if (hasDomainID())
|
||||
return this->sle_.at(sfDomainID);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasDomainID() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfDomainID);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Builder for DirectoryNode ledger entries.
|
||||
* Provides a fluent interface for constructing ledger entries with method chaining.
|
||||
* Uses Json::Value internally for flexible ledger entry construction.
|
||||
* Inherits common field setters from LedgerEntryBuilderBase.
|
||||
*/
|
||||
class DirectoryNodeBuilder : public LedgerEntryBuilderBase<DirectoryNodeBuilder>
|
||||
{
|
||||
public:
|
||||
DirectoryNodeBuilder(std::decay_t<typename SF_VECTOR256::type::value_type> const& indexes,std::decay_t<typename SF_UINT256::type::value_type> const& rootIndex)
|
||||
: LedgerEntryBuilderBase<DirectoryNodeBuilder>(ltDIR_NODE)
|
||||
{
|
||||
setIndexes(indexes);
|
||||
setRootIndex(rootIndex);
|
||||
}
|
||||
|
||||
DirectoryNodeBuilder(SLE const& sle)
|
||||
{
|
||||
if (sle[sfLedgerEntryType] != ltDIR_NODE)
|
||||
{
|
||||
throw std::runtime_error("Invalid ledger entry type for DirectoryNode");
|
||||
}
|
||||
object_ = sle;
|
||||
}
|
||||
|
||||
// Ledger entry-specific field setters
|
||||
|
||||
/**
|
||||
* Set sfOwner (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
DirectoryNodeBuilder&
|
||||
setOwner(std::decay_t<typename SF_ACCOUNT::type::value_type> const& value)
|
||||
{
|
||||
object_[sfOwner] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfTakerPaysCurrency (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
DirectoryNodeBuilder&
|
||||
setTakerPaysCurrency(std::decay_t<typename SF_UINT160::type::value_type> const& value)
|
||||
{
|
||||
object_[sfTakerPaysCurrency] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfTakerPaysIssuer (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
DirectoryNodeBuilder&
|
||||
setTakerPaysIssuer(std::decay_t<typename SF_UINT160::type::value_type> const& value)
|
||||
{
|
||||
object_[sfTakerPaysIssuer] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfTakerGetsCurrency (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
DirectoryNodeBuilder&
|
||||
setTakerGetsCurrency(std::decay_t<typename SF_UINT160::type::value_type> const& value)
|
||||
{
|
||||
object_[sfTakerGetsCurrency] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfTakerGetsIssuer (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
DirectoryNodeBuilder&
|
||||
setTakerGetsIssuer(std::decay_t<typename SF_UINT160::type::value_type> const& value)
|
||||
{
|
||||
object_[sfTakerGetsIssuer] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfExchangeRate (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
DirectoryNodeBuilder&
|
||||
setExchangeRate(std::decay_t<typename SF_UINT64::type::value_type> const& value)
|
||||
{
|
||||
object_[sfExchangeRate] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfIndexes (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
DirectoryNodeBuilder&
|
||||
setIndexes(std::decay_t<typename SF_VECTOR256::type::value_type> const& value)
|
||||
{
|
||||
object_[sfIndexes] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfRootIndex (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
DirectoryNodeBuilder&
|
||||
setRootIndex(std::decay_t<typename SF_UINT256::type::value_type> const& value)
|
||||
{
|
||||
object_[sfRootIndex] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfIndexNext (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
DirectoryNodeBuilder&
|
||||
setIndexNext(std::decay_t<typename SF_UINT64::type::value_type> const& value)
|
||||
{
|
||||
object_[sfIndexNext] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfIndexPrevious (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
DirectoryNodeBuilder&
|
||||
setIndexPrevious(std::decay_t<typename SF_UINT64::type::value_type> const& value)
|
||||
{
|
||||
object_[sfIndexPrevious] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfNFTokenID (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
DirectoryNodeBuilder&
|
||||
setNFTokenID(std::decay_t<typename SF_UINT256::type::value_type> const& value)
|
||||
{
|
||||
object_[sfNFTokenID] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfPreviousTxnID (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
DirectoryNodeBuilder&
|
||||
setPreviousTxnID(std::decay_t<typename SF_UINT256::type::value_type> const& value)
|
||||
{
|
||||
object_[sfPreviousTxnID] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfPreviousTxnLgrSeq (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
DirectoryNodeBuilder&
|
||||
setPreviousTxnLgrSeq(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfPreviousTxnLgrSeq] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfDomainID (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
DirectoryNodeBuilder&
|
||||
setDomainID(std::decay_t<typename SF_UINT256::type::value_type> const& value)
|
||||
{
|
||||
object_[sfDomainID] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build and return the completed DirectoryNode wrapper.
|
||||
* @return The constructed ledger entry wrapper.
|
||||
* @throws std::runtime_error if the JSON cannot be parsed into a valid ledger entry.
|
||||
*/
|
||||
DirectoryNode
|
||||
build(uint256 const& index)
|
||||
{
|
||||
return DirectoryNode{SLE(object_, index)};
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::ledger_entries
|
||||
@@ -1,487 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STLedgerEntry.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/LedgerEntryBase.h>
|
||||
#include <xrpl/protocol_autogen/LedgerEntryBuilderBase.h>
|
||||
#include <xrpl/json/json_value.h>
|
||||
|
||||
#include <stdexcept>
|
||||
#include <optional>
|
||||
|
||||
namespace xrpl::ledger_entries {
|
||||
|
||||
// Forward declaration
|
||||
class EscrowBuilder;
|
||||
|
||||
/**
|
||||
* Ledger Entry: Escrow
|
||||
* Type: ltESCROW (0x0075)
|
||||
* RPC Name: escrow
|
||||
*
|
||||
* Immutable wrapper around SLE providing type-safe field access.
|
||||
* Use EscrowBuilder to construct new ledger entries.
|
||||
*/
|
||||
class Escrow : public LedgerEntryBase
|
||||
{
|
||||
public:
|
||||
static constexpr LedgerEntryType entryType = ltESCROW;
|
||||
|
||||
/**
|
||||
* Construct a Escrow ledger entry wrapper from an existing SLE object.
|
||||
* @throws std::runtime_error if the ledger entry type doesn't match.
|
||||
*/
|
||||
explicit Escrow(SLE const& sle)
|
||||
: LedgerEntryBase(sle)
|
||||
{
|
||||
// Verify ledger entry type
|
||||
if (sle.getType() != entryType)
|
||||
{
|
||||
throw std::runtime_error("Invalid ledger entry type for Escrow");
|
||||
}
|
||||
}
|
||||
|
||||
// Ledger entry-specific field getters
|
||||
|
||||
/**
|
||||
* Get sfAccount (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_ACCOUNT::type::value_type
|
||||
getAccount() const
|
||||
{
|
||||
return this->sle_.at(sfAccount);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfSequence (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT32::type::value_type>
|
||||
getSequence() const
|
||||
{
|
||||
if (hasSequence())
|
||||
return this->sle_.at(sfSequence);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasSequence() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfSequence);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfDestination (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_ACCOUNT::type::value_type
|
||||
getDestination() const
|
||||
{
|
||||
return this->sle_.at(sfDestination);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfAmount (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_AMOUNT::type::value_type
|
||||
getAmount() const
|
||||
{
|
||||
return this->sle_.at(sfAmount);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfCondition (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_VL::type::value_type>
|
||||
getCondition() const
|
||||
{
|
||||
if (hasCondition())
|
||||
return this->sle_.at(sfCondition);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasCondition() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfCondition);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfCancelAfter (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT32::type::value_type>
|
||||
getCancelAfter() const
|
||||
{
|
||||
if (hasCancelAfter())
|
||||
return this->sle_.at(sfCancelAfter);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasCancelAfter() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfCancelAfter);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfFinishAfter (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT32::type::value_type>
|
||||
getFinishAfter() const
|
||||
{
|
||||
if (hasFinishAfter())
|
||||
return this->sle_.at(sfFinishAfter);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasFinishAfter() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfFinishAfter);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfSourceTag (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT32::type::value_type>
|
||||
getSourceTag() const
|
||||
{
|
||||
if (hasSourceTag())
|
||||
return this->sle_.at(sfSourceTag);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasSourceTag() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfSourceTag);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfDestinationTag (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT32::type::value_type>
|
||||
getDestinationTag() const
|
||||
{
|
||||
if (hasDestinationTag())
|
||||
return this->sle_.at(sfDestinationTag);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasDestinationTag() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfDestinationTag);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfOwnerNode (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT64::type::value_type
|
||||
getOwnerNode() const
|
||||
{
|
||||
return this->sle_.at(sfOwnerNode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfPreviousTxnID (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT256::type::value_type
|
||||
getPreviousTxnID() const
|
||||
{
|
||||
return this->sle_.at(sfPreviousTxnID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfPreviousTxnLgrSeq (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT32::type::value_type
|
||||
getPreviousTxnLgrSeq() const
|
||||
{
|
||||
return this->sle_.at(sfPreviousTxnLgrSeq);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfDestinationNode (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT64::type::value_type>
|
||||
getDestinationNode() const
|
||||
{
|
||||
if (hasDestinationNode())
|
||||
return this->sle_.at(sfDestinationNode);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasDestinationNode() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfDestinationNode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfTransferRate (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT32::type::value_type>
|
||||
getTransferRate() const
|
||||
{
|
||||
if (hasTransferRate())
|
||||
return this->sle_.at(sfTransferRate);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasTransferRate() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfTransferRate);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfIssuerNode (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT64::type::value_type>
|
||||
getIssuerNode() const
|
||||
{
|
||||
if (hasIssuerNode())
|
||||
return this->sle_.at(sfIssuerNode);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasIssuerNode() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfIssuerNode);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Builder for Escrow ledger entries.
|
||||
* Provides a fluent interface for constructing ledger entries with method chaining.
|
||||
* Uses Json::Value internally for flexible ledger entry construction.
|
||||
* Inherits common field setters from LedgerEntryBuilderBase.
|
||||
*/
|
||||
class EscrowBuilder : public LedgerEntryBuilderBase<EscrowBuilder>
|
||||
{
|
||||
public:
|
||||
EscrowBuilder(std::decay_t<typename SF_ACCOUNT::type::value_type> const& account,std::decay_t<typename SF_ACCOUNT::type::value_type> const& destination,std::decay_t<typename SF_AMOUNT::type::value_type> const& amount,std::decay_t<typename SF_UINT64::type::value_type> const& ownerNode,std::decay_t<typename SF_UINT256::type::value_type> const& previousTxnID,std::decay_t<typename SF_UINT32::type::value_type> const& previousTxnLgrSeq)
|
||||
: LedgerEntryBuilderBase<EscrowBuilder>(ltESCROW)
|
||||
{
|
||||
setAccount(account);
|
||||
setDestination(destination);
|
||||
setAmount(amount);
|
||||
setOwnerNode(ownerNode);
|
||||
setPreviousTxnID(previousTxnID);
|
||||
setPreviousTxnLgrSeq(previousTxnLgrSeq);
|
||||
}
|
||||
|
||||
EscrowBuilder(SLE const& sle)
|
||||
{
|
||||
if (sle[sfLedgerEntryType] != ltESCROW)
|
||||
{
|
||||
throw std::runtime_error("Invalid ledger entry type for Escrow");
|
||||
}
|
||||
object_ = sle;
|
||||
}
|
||||
|
||||
// Ledger entry-specific field setters
|
||||
|
||||
/**
|
||||
* Set sfAccount (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
EscrowBuilder&
|
||||
setAccount(std::decay_t<typename SF_ACCOUNT::type::value_type> const& value)
|
||||
{
|
||||
object_[sfAccount] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfSequence (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
EscrowBuilder&
|
||||
setSequence(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfSequence] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfDestination (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
EscrowBuilder&
|
||||
setDestination(std::decay_t<typename SF_ACCOUNT::type::value_type> const& value)
|
||||
{
|
||||
object_[sfDestination] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfAmount (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
EscrowBuilder&
|
||||
setAmount(std::decay_t<typename SF_AMOUNT::type::value_type> const& value)
|
||||
{
|
||||
object_[sfAmount] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfCondition (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
EscrowBuilder&
|
||||
setCondition(std::decay_t<typename SF_VL::type::value_type> const& value)
|
||||
{
|
||||
object_[sfCondition] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfCancelAfter (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
EscrowBuilder&
|
||||
setCancelAfter(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfCancelAfter] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfFinishAfter (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
EscrowBuilder&
|
||||
setFinishAfter(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfFinishAfter] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfSourceTag (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
EscrowBuilder&
|
||||
setSourceTag(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfSourceTag] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfDestinationTag (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
EscrowBuilder&
|
||||
setDestinationTag(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfDestinationTag] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfOwnerNode (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
EscrowBuilder&
|
||||
setOwnerNode(std::decay_t<typename SF_UINT64::type::value_type> const& value)
|
||||
{
|
||||
object_[sfOwnerNode] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfPreviousTxnID (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
EscrowBuilder&
|
||||
setPreviousTxnID(std::decay_t<typename SF_UINT256::type::value_type> const& value)
|
||||
{
|
||||
object_[sfPreviousTxnID] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfPreviousTxnLgrSeq (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
EscrowBuilder&
|
||||
setPreviousTxnLgrSeq(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfPreviousTxnLgrSeq] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfDestinationNode (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
EscrowBuilder&
|
||||
setDestinationNode(std::decay_t<typename SF_UINT64::type::value_type> const& value)
|
||||
{
|
||||
object_[sfDestinationNode] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfTransferRate (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
EscrowBuilder&
|
||||
setTransferRate(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfTransferRate] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfIssuerNode (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
EscrowBuilder&
|
||||
setIssuerNode(std::decay_t<typename SF_UINT64::type::value_type> const& value)
|
||||
{
|
||||
object_[sfIssuerNode] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build and return the completed Escrow wrapper.
|
||||
* @return The constructed ledger entry wrapper.
|
||||
* @throws std::runtime_error if the JSON cannot be parsed into a valid ledger entry.
|
||||
*/
|
||||
Escrow
|
||||
build(uint256 const& index)
|
||||
{
|
||||
return Escrow{SLE(object_, index)};
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::ledger_entries
|
||||
@@ -1,355 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STLedgerEntry.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/LedgerEntryBase.h>
|
||||
#include <xrpl/protocol_autogen/LedgerEntryBuilderBase.h>
|
||||
#include <xrpl/json/json_value.h>
|
||||
|
||||
#include <stdexcept>
|
||||
#include <optional>
|
||||
|
||||
namespace xrpl::ledger_entries {
|
||||
|
||||
// Forward declaration
|
||||
class FeeSettingsBuilder;
|
||||
|
||||
/**
|
||||
* Ledger Entry: FeeSettings
|
||||
* Type: ltFEE_SETTINGS (0x0073)
|
||||
* RPC Name: fee
|
||||
*
|
||||
* Immutable wrapper around SLE providing type-safe field access.
|
||||
* Use FeeSettingsBuilder to construct new ledger entries.
|
||||
*/
|
||||
class FeeSettings : public LedgerEntryBase
|
||||
{
|
||||
public:
|
||||
static constexpr LedgerEntryType entryType = ltFEE_SETTINGS;
|
||||
|
||||
/**
|
||||
* Construct a FeeSettings ledger entry wrapper from an existing SLE object.
|
||||
* @throws std::runtime_error if the ledger entry type doesn't match.
|
||||
*/
|
||||
explicit FeeSettings(SLE const& sle)
|
||||
: LedgerEntryBase(sle)
|
||||
{
|
||||
// Verify ledger entry type
|
||||
if (sle.getType() != entryType)
|
||||
{
|
||||
throw std::runtime_error("Invalid ledger entry type for FeeSettings");
|
||||
}
|
||||
}
|
||||
|
||||
// Ledger entry-specific field getters
|
||||
|
||||
/**
|
||||
* Get sfBaseFee (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT64::type::value_type>
|
||||
getBaseFee() const
|
||||
{
|
||||
if (hasBaseFee())
|
||||
return this->sle_.at(sfBaseFee);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasBaseFee() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfBaseFee);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfReferenceFeeUnits (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT32::type::value_type>
|
||||
getReferenceFeeUnits() const
|
||||
{
|
||||
if (hasReferenceFeeUnits())
|
||||
return this->sle_.at(sfReferenceFeeUnits);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasReferenceFeeUnits() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfReferenceFeeUnits);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfReserveBase (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT32::type::value_type>
|
||||
getReserveBase() const
|
||||
{
|
||||
if (hasReserveBase())
|
||||
return this->sle_.at(sfReserveBase);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasReserveBase() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfReserveBase);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfReserveIncrement (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT32::type::value_type>
|
||||
getReserveIncrement() const
|
||||
{
|
||||
if (hasReserveIncrement())
|
||||
return this->sle_.at(sfReserveIncrement);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasReserveIncrement() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfReserveIncrement);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfBaseFeeDrops (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_AMOUNT::type::value_type>
|
||||
getBaseFeeDrops() const
|
||||
{
|
||||
if (hasBaseFeeDrops())
|
||||
return this->sle_.at(sfBaseFeeDrops);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasBaseFeeDrops() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfBaseFeeDrops);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfReserveBaseDrops (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_AMOUNT::type::value_type>
|
||||
getReserveBaseDrops() const
|
||||
{
|
||||
if (hasReserveBaseDrops())
|
||||
return this->sle_.at(sfReserveBaseDrops);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasReserveBaseDrops() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfReserveBaseDrops);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfReserveIncrementDrops (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_AMOUNT::type::value_type>
|
||||
getReserveIncrementDrops() const
|
||||
{
|
||||
if (hasReserveIncrementDrops())
|
||||
return this->sle_.at(sfReserveIncrementDrops);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasReserveIncrementDrops() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfReserveIncrementDrops);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfPreviousTxnID (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT256::type::value_type>
|
||||
getPreviousTxnID() const
|
||||
{
|
||||
if (hasPreviousTxnID())
|
||||
return this->sle_.at(sfPreviousTxnID);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasPreviousTxnID() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfPreviousTxnID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfPreviousTxnLgrSeq (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT32::type::value_type>
|
||||
getPreviousTxnLgrSeq() const
|
||||
{
|
||||
if (hasPreviousTxnLgrSeq())
|
||||
return this->sle_.at(sfPreviousTxnLgrSeq);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasPreviousTxnLgrSeq() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfPreviousTxnLgrSeq);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Builder for FeeSettings ledger entries.
|
||||
* Provides a fluent interface for constructing ledger entries with method chaining.
|
||||
* Uses Json::Value internally for flexible ledger entry construction.
|
||||
* Inherits common field setters from LedgerEntryBuilderBase.
|
||||
*/
|
||||
class FeeSettingsBuilder : public LedgerEntryBuilderBase<FeeSettingsBuilder>
|
||||
{
|
||||
public:
|
||||
FeeSettingsBuilder()
|
||||
: LedgerEntryBuilderBase<FeeSettingsBuilder>(ltFEE_SETTINGS)
|
||||
{
|
||||
}
|
||||
|
||||
FeeSettingsBuilder(SLE const& sle)
|
||||
{
|
||||
if (sle[sfLedgerEntryType] != ltFEE_SETTINGS)
|
||||
{
|
||||
throw std::runtime_error("Invalid ledger entry type for FeeSettings");
|
||||
}
|
||||
object_ = sle;
|
||||
}
|
||||
|
||||
// Ledger entry-specific field setters
|
||||
|
||||
/**
|
||||
* Set sfBaseFee (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
FeeSettingsBuilder&
|
||||
setBaseFee(std::decay_t<typename SF_UINT64::type::value_type> const& value)
|
||||
{
|
||||
object_[sfBaseFee] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfReferenceFeeUnits (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
FeeSettingsBuilder&
|
||||
setReferenceFeeUnits(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfReferenceFeeUnits] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfReserveBase (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
FeeSettingsBuilder&
|
||||
setReserveBase(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfReserveBase] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfReserveIncrement (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
FeeSettingsBuilder&
|
||||
setReserveIncrement(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfReserveIncrement] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfBaseFeeDrops (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
FeeSettingsBuilder&
|
||||
setBaseFeeDrops(std::decay_t<typename SF_AMOUNT::type::value_type> const& value)
|
||||
{
|
||||
object_[sfBaseFeeDrops] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfReserveBaseDrops (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
FeeSettingsBuilder&
|
||||
setReserveBaseDrops(std::decay_t<typename SF_AMOUNT::type::value_type> const& value)
|
||||
{
|
||||
object_[sfReserveBaseDrops] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfReserveIncrementDrops (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
FeeSettingsBuilder&
|
||||
setReserveIncrementDrops(std::decay_t<typename SF_AMOUNT::type::value_type> const& value)
|
||||
{
|
||||
object_[sfReserveIncrementDrops] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfPreviousTxnID (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
FeeSettingsBuilder&
|
||||
setPreviousTxnID(std::decay_t<typename SF_UINT256::type::value_type> const& value)
|
||||
{
|
||||
object_[sfPreviousTxnID] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfPreviousTxnLgrSeq (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
FeeSettingsBuilder&
|
||||
setPreviousTxnLgrSeq(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfPreviousTxnLgrSeq] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build and return the completed FeeSettings wrapper.
|
||||
* @return The constructed ledger entry wrapper.
|
||||
* @throws std::runtime_error if the JSON cannot be parsed into a valid ledger entry.
|
||||
*/
|
||||
FeeSettings
|
||||
build(uint256 const& index)
|
||||
{
|
||||
return FeeSettings{SLE(object_, index)};
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::ledger_entries
|
||||
@@ -1,167 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STLedgerEntry.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/LedgerEntryBase.h>
|
||||
#include <xrpl/protocol_autogen/LedgerEntryBuilderBase.h>
|
||||
#include <xrpl/json/json_value.h>
|
||||
|
||||
#include <stdexcept>
|
||||
#include <optional>
|
||||
|
||||
namespace xrpl::ledger_entries {
|
||||
|
||||
// Forward declaration
|
||||
class LedgerHashesBuilder;
|
||||
|
||||
/**
|
||||
* Ledger Entry: LedgerHashes
|
||||
* Type: ltLEDGER_HASHES (0x0068)
|
||||
* RPC Name: hashes
|
||||
*
|
||||
* Immutable wrapper around SLE providing type-safe field access.
|
||||
* Use LedgerHashesBuilder to construct new ledger entries.
|
||||
*/
|
||||
class LedgerHashes : public LedgerEntryBase
|
||||
{
|
||||
public:
|
||||
static constexpr LedgerEntryType entryType = ltLEDGER_HASHES;
|
||||
|
||||
/**
|
||||
* Construct a LedgerHashes ledger entry wrapper from an existing SLE object.
|
||||
* @throws std::runtime_error if the ledger entry type doesn't match.
|
||||
*/
|
||||
explicit LedgerHashes(SLE const& sle)
|
||||
: LedgerEntryBase(sle)
|
||||
{
|
||||
// Verify ledger entry type
|
||||
if (sle.getType() != entryType)
|
||||
{
|
||||
throw std::runtime_error("Invalid ledger entry type for LedgerHashes");
|
||||
}
|
||||
}
|
||||
|
||||
// Ledger entry-specific field getters
|
||||
|
||||
/**
|
||||
* Get sfFirstLedgerSequence (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT32::type::value_type>
|
||||
getFirstLedgerSequence() const
|
||||
{
|
||||
if (hasFirstLedgerSequence())
|
||||
return this->sle_.at(sfFirstLedgerSequence);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasFirstLedgerSequence() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfFirstLedgerSequence);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfLastLedgerSequence (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT32::type::value_type>
|
||||
getLastLedgerSequence() const
|
||||
{
|
||||
if (hasLastLedgerSequence())
|
||||
return this->sle_.at(sfLastLedgerSequence);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasLastLedgerSequence() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfLastLedgerSequence);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfHashes (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_VECTOR256::type::value_type
|
||||
getHashes() const
|
||||
{
|
||||
return this->sle_.at(sfHashes);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Builder for LedgerHashes ledger entries.
|
||||
* Provides a fluent interface for constructing ledger entries with method chaining.
|
||||
* Uses Json::Value internally for flexible ledger entry construction.
|
||||
* Inherits common field setters from LedgerEntryBuilderBase.
|
||||
*/
|
||||
class LedgerHashesBuilder : public LedgerEntryBuilderBase<LedgerHashesBuilder>
|
||||
{
|
||||
public:
|
||||
LedgerHashesBuilder(std::decay_t<typename SF_VECTOR256::type::value_type> const& hashes)
|
||||
: LedgerEntryBuilderBase<LedgerHashesBuilder>(ltLEDGER_HASHES)
|
||||
{
|
||||
setHashes(hashes);
|
||||
}
|
||||
|
||||
LedgerHashesBuilder(SLE const& sle)
|
||||
{
|
||||
if (sle[sfLedgerEntryType] != ltLEDGER_HASHES)
|
||||
{
|
||||
throw std::runtime_error("Invalid ledger entry type for LedgerHashes");
|
||||
}
|
||||
object_ = sle;
|
||||
}
|
||||
|
||||
// Ledger entry-specific field setters
|
||||
|
||||
/**
|
||||
* Set sfFirstLedgerSequence (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
LedgerHashesBuilder&
|
||||
setFirstLedgerSequence(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfFirstLedgerSequence] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfLastLedgerSequence (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
LedgerHashesBuilder&
|
||||
setLastLedgerSequence(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfLastLedgerSequence] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfHashes (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
LedgerHashesBuilder&
|
||||
setHashes(std::decay_t<typename SF_VECTOR256::type::value_type> const& value)
|
||||
{
|
||||
object_[sfHashes] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build and return the completed LedgerHashes wrapper.
|
||||
* @return The constructed ledger entry wrapper.
|
||||
* @throws std::runtime_error if the JSON cannot be parsed into a valid ledger entry.
|
||||
*/
|
||||
LedgerHashes
|
||||
build(uint256 const& index)
|
||||
{
|
||||
return LedgerHashes{SLE(object_, index)};
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::ledger_entries
|
||||
@@ -1,815 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STLedgerEntry.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/LedgerEntryBase.h>
|
||||
#include <xrpl/protocol_autogen/LedgerEntryBuilderBase.h>
|
||||
#include <xrpl/json/json_value.h>
|
||||
|
||||
#include <stdexcept>
|
||||
#include <optional>
|
||||
|
||||
namespace xrpl::ledger_entries {
|
||||
|
||||
// Forward declaration
|
||||
class LoanBuilder;
|
||||
|
||||
/**
|
||||
* Ledger Entry: Loan
|
||||
* Type: ltLOAN (0x0089)
|
||||
* RPC Name: loan
|
||||
*
|
||||
* Immutable wrapper around SLE providing type-safe field access.
|
||||
* Use LoanBuilder to construct new ledger entries.
|
||||
*/
|
||||
class Loan : public LedgerEntryBase
|
||||
{
|
||||
public:
|
||||
static constexpr LedgerEntryType entryType = ltLOAN;
|
||||
|
||||
/**
|
||||
* Construct a Loan ledger entry wrapper from an existing SLE object.
|
||||
* @throws std::runtime_error if the ledger entry type doesn't match.
|
||||
*/
|
||||
explicit Loan(SLE const& sle)
|
||||
: LedgerEntryBase(sle)
|
||||
{
|
||||
// Verify ledger entry type
|
||||
if (sle.getType() != entryType)
|
||||
{
|
||||
throw std::runtime_error("Invalid ledger entry type for Loan");
|
||||
}
|
||||
}
|
||||
|
||||
// Ledger entry-specific field getters
|
||||
|
||||
/**
|
||||
* Get sfPreviousTxnID (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT256::type::value_type
|
||||
getPreviousTxnID() const
|
||||
{
|
||||
return this->sle_.at(sfPreviousTxnID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfPreviousTxnLgrSeq (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT32::type::value_type
|
||||
getPreviousTxnLgrSeq() const
|
||||
{
|
||||
return this->sle_.at(sfPreviousTxnLgrSeq);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfOwnerNode (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT64::type::value_type
|
||||
getOwnerNode() const
|
||||
{
|
||||
return this->sle_.at(sfOwnerNode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfLoanBrokerNode (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT64::type::value_type
|
||||
getLoanBrokerNode() const
|
||||
{
|
||||
return this->sle_.at(sfLoanBrokerNode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfLoanBrokerID (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT256::type::value_type
|
||||
getLoanBrokerID() const
|
||||
{
|
||||
return this->sle_.at(sfLoanBrokerID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfLoanSequence (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT32::type::value_type
|
||||
getLoanSequence() const
|
||||
{
|
||||
return this->sle_.at(sfLoanSequence);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfBorrower (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_ACCOUNT::type::value_type
|
||||
getBorrower() const
|
||||
{
|
||||
return this->sle_.at(sfBorrower);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfLoanOriginationFee (soeDEFAULT)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_NUMBER::type::value_type>
|
||||
getLoanOriginationFee() const
|
||||
{
|
||||
if (hasLoanOriginationFee())
|
||||
return this->sle_.at(sfLoanOriginationFee);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasLoanOriginationFee() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfLoanOriginationFee);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfLoanServiceFee (soeDEFAULT)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_NUMBER::type::value_type>
|
||||
getLoanServiceFee() const
|
||||
{
|
||||
if (hasLoanServiceFee())
|
||||
return this->sle_.at(sfLoanServiceFee);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasLoanServiceFee() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfLoanServiceFee);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfLatePaymentFee (soeDEFAULT)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_NUMBER::type::value_type>
|
||||
getLatePaymentFee() const
|
||||
{
|
||||
if (hasLatePaymentFee())
|
||||
return this->sle_.at(sfLatePaymentFee);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasLatePaymentFee() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfLatePaymentFee);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfClosePaymentFee (soeDEFAULT)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_NUMBER::type::value_type>
|
||||
getClosePaymentFee() const
|
||||
{
|
||||
if (hasClosePaymentFee())
|
||||
return this->sle_.at(sfClosePaymentFee);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasClosePaymentFee() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfClosePaymentFee);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfOverpaymentFee (soeDEFAULT)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT32::type::value_type>
|
||||
getOverpaymentFee() const
|
||||
{
|
||||
if (hasOverpaymentFee())
|
||||
return this->sle_.at(sfOverpaymentFee);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasOverpaymentFee() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfOverpaymentFee);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfInterestRate (soeDEFAULT)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT32::type::value_type>
|
||||
getInterestRate() const
|
||||
{
|
||||
if (hasInterestRate())
|
||||
return this->sle_.at(sfInterestRate);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasInterestRate() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfInterestRate);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfLateInterestRate (soeDEFAULT)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT32::type::value_type>
|
||||
getLateInterestRate() const
|
||||
{
|
||||
if (hasLateInterestRate())
|
||||
return this->sle_.at(sfLateInterestRate);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasLateInterestRate() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfLateInterestRate);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfCloseInterestRate (soeDEFAULT)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT32::type::value_type>
|
||||
getCloseInterestRate() const
|
||||
{
|
||||
if (hasCloseInterestRate())
|
||||
return this->sle_.at(sfCloseInterestRate);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasCloseInterestRate() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfCloseInterestRate);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfOverpaymentInterestRate (soeDEFAULT)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT32::type::value_type>
|
||||
getOverpaymentInterestRate() const
|
||||
{
|
||||
if (hasOverpaymentInterestRate())
|
||||
return this->sle_.at(sfOverpaymentInterestRate);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasOverpaymentInterestRate() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfOverpaymentInterestRate);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfStartDate (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT32::type::value_type
|
||||
getStartDate() const
|
||||
{
|
||||
return this->sle_.at(sfStartDate);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfPaymentInterval (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT32::type::value_type
|
||||
getPaymentInterval() const
|
||||
{
|
||||
return this->sle_.at(sfPaymentInterval);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfGracePeriod (soeDEFAULT)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT32::type::value_type>
|
||||
getGracePeriod() const
|
||||
{
|
||||
if (hasGracePeriod())
|
||||
return this->sle_.at(sfGracePeriod);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasGracePeriod() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfGracePeriod);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfPreviousPaymentDueDate (soeDEFAULT)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT32::type::value_type>
|
||||
getPreviousPaymentDueDate() const
|
||||
{
|
||||
if (hasPreviousPaymentDueDate())
|
||||
return this->sle_.at(sfPreviousPaymentDueDate);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasPreviousPaymentDueDate() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfPreviousPaymentDueDate);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfNextPaymentDueDate (soeDEFAULT)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT32::type::value_type>
|
||||
getNextPaymentDueDate() const
|
||||
{
|
||||
if (hasNextPaymentDueDate())
|
||||
return this->sle_.at(sfNextPaymentDueDate);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasNextPaymentDueDate() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfNextPaymentDueDate);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfPaymentRemaining (soeDEFAULT)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT32::type::value_type>
|
||||
getPaymentRemaining() const
|
||||
{
|
||||
if (hasPaymentRemaining())
|
||||
return this->sle_.at(sfPaymentRemaining);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasPaymentRemaining() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfPaymentRemaining);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfPeriodicPayment (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_NUMBER::type::value_type
|
||||
getPeriodicPayment() const
|
||||
{
|
||||
return this->sle_.at(sfPeriodicPayment);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfPrincipalOutstanding (soeDEFAULT)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_NUMBER::type::value_type>
|
||||
getPrincipalOutstanding() const
|
||||
{
|
||||
if (hasPrincipalOutstanding())
|
||||
return this->sle_.at(sfPrincipalOutstanding);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasPrincipalOutstanding() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfPrincipalOutstanding);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfTotalValueOutstanding (soeDEFAULT)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_NUMBER::type::value_type>
|
||||
getTotalValueOutstanding() const
|
||||
{
|
||||
if (hasTotalValueOutstanding())
|
||||
return this->sle_.at(sfTotalValueOutstanding);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasTotalValueOutstanding() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfTotalValueOutstanding);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfManagementFeeOutstanding (soeDEFAULT)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_NUMBER::type::value_type>
|
||||
getManagementFeeOutstanding() const
|
||||
{
|
||||
if (hasManagementFeeOutstanding())
|
||||
return this->sle_.at(sfManagementFeeOutstanding);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasManagementFeeOutstanding() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfManagementFeeOutstanding);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfLoanScale (soeDEFAULT)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_INT32::type::value_type>
|
||||
getLoanScale() const
|
||||
{
|
||||
if (hasLoanScale())
|
||||
return this->sle_.at(sfLoanScale);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasLoanScale() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfLoanScale);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Builder for Loan ledger entries.
|
||||
* Provides a fluent interface for constructing ledger entries with method chaining.
|
||||
* Uses Json::Value internally for flexible ledger entry construction.
|
||||
* Inherits common field setters from LedgerEntryBuilderBase.
|
||||
*/
|
||||
class LoanBuilder : public LedgerEntryBuilderBase<LoanBuilder>
|
||||
{
|
||||
public:
|
||||
LoanBuilder(std::decay_t<typename SF_UINT256::type::value_type> const& previousTxnID,std::decay_t<typename SF_UINT32::type::value_type> const& previousTxnLgrSeq,std::decay_t<typename SF_UINT64::type::value_type> const& ownerNode,std::decay_t<typename SF_UINT64::type::value_type> const& loanBrokerNode,std::decay_t<typename SF_UINT256::type::value_type> const& loanBrokerID,std::decay_t<typename SF_UINT32::type::value_type> const& loanSequence,std::decay_t<typename SF_ACCOUNT::type::value_type> const& borrower,std::decay_t<typename SF_UINT32::type::value_type> const& startDate,std::decay_t<typename SF_UINT32::type::value_type> const& paymentInterval,std::decay_t<typename SF_NUMBER::type::value_type> const& periodicPayment)
|
||||
: LedgerEntryBuilderBase<LoanBuilder>(ltLOAN)
|
||||
{
|
||||
setPreviousTxnID(previousTxnID);
|
||||
setPreviousTxnLgrSeq(previousTxnLgrSeq);
|
||||
setOwnerNode(ownerNode);
|
||||
setLoanBrokerNode(loanBrokerNode);
|
||||
setLoanBrokerID(loanBrokerID);
|
||||
setLoanSequence(loanSequence);
|
||||
setBorrower(borrower);
|
||||
setStartDate(startDate);
|
||||
setPaymentInterval(paymentInterval);
|
||||
setPeriodicPayment(periodicPayment);
|
||||
}
|
||||
|
||||
LoanBuilder(SLE const& sle)
|
||||
{
|
||||
if (sle[sfLedgerEntryType] != ltLOAN)
|
||||
{
|
||||
throw std::runtime_error("Invalid ledger entry type for Loan");
|
||||
}
|
||||
object_ = sle;
|
||||
}
|
||||
|
||||
// Ledger entry-specific field setters
|
||||
|
||||
/**
|
||||
* Set sfPreviousTxnID (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
LoanBuilder&
|
||||
setPreviousTxnID(std::decay_t<typename SF_UINT256::type::value_type> const& value)
|
||||
{
|
||||
object_[sfPreviousTxnID] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfPreviousTxnLgrSeq (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
LoanBuilder&
|
||||
setPreviousTxnLgrSeq(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfPreviousTxnLgrSeq] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfOwnerNode (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
LoanBuilder&
|
||||
setOwnerNode(std::decay_t<typename SF_UINT64::type::value_type> const& value)
|
||||
{
|
||||
object_[sfOwnerNode] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfLoanBrokerNode (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
LoanBuilder&
|
||||
setLoanBrokerNode(std::decay_t<typename SF_UINT64::type::value_type> const& value)
|
||||
{
|
||||
object_[sfLoanBrokerNode] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfLoanBrokerID (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
LoanBuilder&
|
||||
setLoanBrokerID(std::decay_t<typename SF_UINT256::type::value_type> const& value)
|
||||
{
|
||||
object_[sfLoanBrokerID] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfLoanSequence (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
LoanBuilder&
|
||||
setLoanSequence(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfLoanSequence] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfBorrower (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
LoanBuilder&
|
||||
setBorrower(std::decay_t<typename SF_ACCOUNT::type::value_type> const& value)
|
||||
{
|
||||
object_[sfBorrower] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfLoanOriginationFee (soeDEFAULT)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
LoanBuilder&
|
||||
setLoanOriginationFee(std::decay_t<typename SF_NUMBER::type::value_type> const& value)
|
||||
{
|
||||
object_[sfLoanOriginationFee] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfLoanServiceFee (soeDEFAULT)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
LoanBuilder&
|
||||
setLoanServiceFee(std::decay_t<typename SF_NUMBER::type::value_type> const& value)
|
||||
{
|
||||
object_[sfLoanServiceFee] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfLatePaymentFee (soeDEFAULT)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
LoanBuilder&
|
||||
setLatePaymentFee(std::decay_t<typename SF_NUMBER::type::value_type> const& value)
|
||||
{
|
||||
object_[sfLatePaymentFee] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfClosePaymentFee (soeDEFAULT)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
LoanBuilder&
|
||||
setClosePaymentFee(std::decay_t<typename SF_NUMBER::type::value_type> const& value)
|
||||
{
|
||||
object_[sfClosePaymentFee] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfOverpaymentFee (soeDEFAULT)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
LoanBuilder&
|
||||
setOverpaymentFee(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfOverpaymentFee] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfInterestRate (soeDEFAULT)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
LoanBuilder&
|
||||
setInterestRate(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfInterestRate] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfLateInterestRate (soeDEFAULT)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
LoanBuilder&
|
||||
setLateInterestRate(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfLateInterestRate] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfCloseInterestRate (soeDEFAULT)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
LoanBuilder&
|
||||
setCloseInterestRate(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfCloseInterestRate] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfOverpaymentInterestRate (soeDEFAULT)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
LoanBuilder&
|
||||
setOverpaymentInterestRate(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfOverpaymentInterestRate] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfStartDate (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
LoanBuilder&
|
||||
setStartDate(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfStartDate] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfPaymentInterval (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
LoanBuilder&
|
||||
setPaymentInterval(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfPaymentInterval] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfGracePeriod (soeDEFAULT)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
LoanBuilder&
|
||||
setGracePeriod(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfGracePeriod] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfPreviousPaymentDueDate (soeDEFAULT)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
LoanBuilder&
|
||||
setPreviousPaymentDueDate(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfPreviousPaymentDueDate] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfNextPaymentDueDate (soeDEFAULT)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
LoanBuilder&
|
||||
setNextPaymentDueDate(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfNextPaymentDueDate] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfPaymentRemaining (soeDEFAULT)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
LoanBuilder&
|
||||
setPaymentRemaining(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfPaymentRemaining] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfPeriodicPayment (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
LoanBuilder&
|
||||
setPeriodicPayment(std::decay_t<typename SF_NUMBER::type::value_type> const& value)
|
||||
{
|
||||
object_[sfPeriodicPayment] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfPrincipalOutstanding (soeDEFAULT)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
LoanBuilder&
|
||||
setPrincipalOutstanding(std::decay_t<typename SF_NUMBER::type::value_type> const& value)
|
||||
{
|
||||
object_[sfPrincipalOutstanding] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfTotalValueOutstanding (soeDEFAULT)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
LoanBuilder&
|
||||
setTotalValueOutstanding(std::decay_t<typename SF_NUMBER::type::value_type> const& value)
|
||||
{
|
||||
object_[sfTotalValueOutstanding] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfManagementFeeOutstanding (soeDEFAULT)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
LoanBuilder&
|
||||
setManagementFeeOutstanding(std::decay_t<typename SF_NUMBER::type::value_type> const& value)
|
||||
{
|
||||
object_[sfManagementFeeOutstanding] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfLoanScale (soeDEFAULT)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
LoanBuilder&
|
||||
setLoanScale(std::decay_t<typename SF_INT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfLoanScale] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build and return the completed Loan wrapper.
|
||||
* @return The constructed ledger entry wrapper.
|
||||
* @throws std::runtime_error if the JSON cannot be parsed into a valid ledger entry.
|
||||
*/
|
||||
Loan
|
||||
build(uint256 const& index)
|
||||
{
|
||||
return Loan{SLE(object_, index)};
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::ledger_entries
|
||||
@@ -1,523 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STLedgerEntry.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/LedgerEntryBase.h>
|
||||
#include <xrpl/protocol_autogen/LedgerEntryBuilderBase.h>
|
||||
#include <xrpl/json/json_value.h>
|
||||
|
||||
#include <stdexcept>
|
||||
#include <optional>
|
||||
|
||||
namespace xrpl::ledger_entries {
|
||||
|
||||
// Forward declaration
|
||||
class LoanBrokerBuilder;
|
||||
|
||||
/**
|
||||
* Ledger Entry: LoanBroker
|
||||
* Type: ltLOAN_BROKER (0x0088)
|
||||
* RPC Name: loan_broker
|
||||
*
|
||||
* Immutable wrapper around SLE providing type-safe field access.
|
||||
* Use LoanBrokerBuilder to construct new ledger entries.
|
||||
*/
|
||||
class LoanBroker : public LedgerEntryBase
|
||||
{
|
||||
public:
|
||||
static constexpr LedgerEntryType entryType = ltLOAN_BROKER;
|
||||
|
||||
/**
|
||||
* Construct a LoanBroker ledger entry wrapper from an existing SLE object.
|
||||
* @throws std::runtime_error if the ledger entry type doesn't match.
|
||||
*/
|
||||
explicit LoanBroker(SLE const& sle)
|
||||
: LedgerEntryBase(sle)
|
||||
{
|
||||
// Verify ledger entry type
|
||||
if (sle.getType() != entryType)
|
||||
{
|
||||
throw std::runtime_error("Invalid ledger entry type for LoanBroker");
|
||||
}
|
||||
}
|
||||
|
||||
// Ledger entry-specific field getters
|
||||
|
||||
/**
|
||||
* Get sfPreviousTxnID (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT256::type::value_type
|
||||
getPreviousTxnID() const
|
||||
{
|
||||
return this->sle_.at(sfPreviousTxnID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfPreviousTxnLgrSeq (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT32::type::value_type
|
||||
getPreviousTxnLgrSeq() const
|
||||
{
|
||||
return this->sle_.at(sfPreviousTxnLgrSeq);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfSequence (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT32::type::value_type
|
||||
getSequence() const
|
||||
{
|
||||
return this->sle_.at(sfSequence);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfOwnerNode (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT64::type::value_type
|
||||
getOwnerNode() const
|
||||
{
|
||||
return this->sle_.at(sfOwnerNode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfVaultNode (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT64::type::value_type
|
||||
getVaultNode() const
|
||||
{
|
||||
return this->sle_.at(sfVaultNode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfVaultID (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT256::type::value_type
|
||||
getVaultID() const
|
||||
{
|
||||
return this->sle_.at(sfVaultID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfAccount (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_ACCOUNT::type::value_type
|
||||
getAccount() const
|
||||
{
|
||||
return this->sle_.at(sfAccount);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfOwner (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_ACCOUNT::type::value_type
|
||||
getOwner() const
|
||||
{
|
||||
return this->sle_.at(sfOwner);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfLoanSequence (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT32::type::value_type
|
||||
getLoanSequence() const
|
||||
{
|
||||
return this->sle_.at(sfLoanSequence);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfData (soeDEFAULT)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_VL::type::value_type>
|
||||
getData() const
|
||||
{
|
||||
if (hasData())
|
||||
return this->sle_.at(sfData);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasData() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfData);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfManagementFeeRate (soeDEFAULT)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT16::type::value_type>
|
||||
getManagementFeeRate() const
|
||||
{
|
||||
if (hasManagementFeeRate())
|
||||
return this->sle_.at(sfManagementFeeRate);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasManagementFeeRate() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfManagementFeeRate);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfOwnerCount (soeDEFAULT)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT32::type::value_type>
|
||||
getOwnerCount() const
|
||||
{
|
||||
if (hasOwnerCount())
|
||||
return this->sle_.at(sfOwnerCount);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasOwnerCount() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfOwnerCount);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfDebtTotal (soeDEFAULT)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_NUMBER::type::value_type>
|
||||
getDebtTotal() const
|
||||
{
|
||||
if (hasDebtTotal())
|
||||
return this->sle_.at(sfDebtTotal);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasDebtTotal() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfDebtTotal);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfDebtMaximum (soeDEFAULT)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_NUMBER::type::value_type>
|
||||
getDebtMaximum() const
|
||||
{
|
||||
if (hasDebtMaximum())
|
||||
return this->sle_.at(sfDebtMaximum);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasDebtMaximum() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfDebtMaximum);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfCoverAvailable (soeDEFAULT)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_NUMBER::type::value_type>
|
||||
getCoverAvailable() const
|
||||
{
|
||||
if (hasCoverAvailable())
|
||||
return this->sle_.at(sfCoverAvailable);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasCoverAvailable() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfCoverAvailable);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfCoverRateMinimum (soeDEFAULT)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT32::type::value_type>
|
||||
getCoverRateMinimum() const
|
||||
{
|
||||
if (hasCoverRateMinimum())
|
||||
return this->sle_.at(sfCoverRateMinimum);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasCoverRateMinimum() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfCoverRateMinimum);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfCoverRateLiquidation (soeDEFAULT)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT32::type::value_type>
|
||||
getCoverRateLiquidation() const
|
||||
{
|
||||
if (hasCoverRateLiquidation())
|
||||
return this->sle_.at(sfCoverRateLiquidation);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasCoverRateLiquidation() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfCoverRateLiquidation);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Builder for LoanBroker ledger entries.
|
||||
* Provides a fluent interface for constructing ledger entries with method chaining.
|
||||
* Uses Json::Value internally for flexible ledger entry construction.
|
||||
* Inherits common field setters from LedgerEntryBuilderBase.
|
||||
*/
|
||||
class LoanBrokerBuilder : public LedgerEntryBuilderBase<LoanBrokerBuilder>
|
||||
{
|
||||
public:
|
||||
LoanBrokerBuilder(std::decay_t<typename SF_UINT256::type::value_type> const& previousTxnID,std::decay_t<typename SF_UINT32::type::value_type> const& previousTxnLgrSeq,std::decay_t<typename SF_UINT32::type::value_type> const& sequence,std::decay_t<typename SF_UINT64::type::value_type> const& ownerNode,std::decay_t<typename SF_UINT64::type::value_type> const& vaultNode,std::decay_t<typename SF_UINT256::type::value_type> const& vaultID,std::decay_t<typename SF_ACCOUNT::type::value_type> const& account,std::decay_t<typename SF_ACCOUNT::type::value_type> const& owner,std::decay_t<typename SF_UINT32::type::value_type> const& loanSequence)
|
||||
: LedgerEntryBuilderBase<LoanBrokerBuilder>(ltLOAN_BROKER)
|
||||
{
|
||||
setPreviousTxnID(previousTxnID);
|
||||
setPreviousTxnLgrSeq(previousTxnLgrSeq);
|
||||
setSequence(sequence);
|
||||
setOwnerNode(ownerNode);
|
||||
setVaultNode(vaultNode);
|
||||
setVaultID(vaultID);
|
||||
setAccount(account);
|
||||
setOwner(owner);
|
||||
setLoanSequence(loanSequence);
|
||||
}
|
||||
|
||||
LoanBrokerBuilder(SLE const& sle)
|
||||
{
|
||||
if (sle[sfLedgerEntryType] != ltLOAN_BROKER)
|
||||
{
|
||||
throw std::runtime_error("Invalid ledger entry type for LoanBroker");
|
||||
}
|
||||
object_ = sle;
|
||||
}
|
||||
|
||||
// Ledger entry-specific field setters
|
||||
|
||||
/**
|
||||
* Set sfPreviousTxnID (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
LoanBrokerBuilder&
|
||||
setPreviousTxnID(std::decay_t<typename SF_UINT256::type::value_type> const& value)
|
||||
{
|
||||
object_[sfPreviousTxnID] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfPreviousTxnLgrSeq (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
LoanBrokerBuilder&
|
||||
setPreviousTxnLgrSeq(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfPreviousTxnLgrSeq] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfSequence (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
LoanBrokerBuilder&
|
||||
setSequence(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfSequence] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfOwnerNode (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
LoanBrokerBuilder&
|
||||
setOwnerNode(std::decay_t<typename SF_UINT64::type::value_type> const& value)
|
||||
{
|
||||
object_[sfOwnerNode] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfVaultNode (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
LoanBrokerBuilder&
|
||||
setVaultNode(std::decay_t<typename SF_UINT64::type::value_type> const& value)
|
||||
{
|
||||
object_[sfVaultNode] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfVaultID (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
LoanBrokerBuilder&
|
||||
setVaultID(std::decay_t<typename SF_UINT256::type::value_type> const& value)
|
||||
{
|
||||
object_[sfVaultID] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfAccount (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
LoanBrokerBuilder&
|
||||
setAccount(std::decay_t<typename SF_ACCOUNT::type::value_type> const& value)
|
||||
{
|
||||
object_[sfAccount] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfOwner (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
LoanBrokerBuilder&
|
||||
setOwner(std::decay_t<typename SF_ACCOUNT::type::value_type> const& value)
|
||||
{
|
||||
object_[sfOwner] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfLoanSequence (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
LoanBrokerBuilder&
|
||||
setLoanSequence(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfLoanSequence] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfData (soeDEFAULT)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
LoanBrokerBuilder&
|
||||
setData(std::decay_t<typename SF_VL::type::value_type> const& value)
|
||||
{
|
||||
object_[sfData] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfManagementFeeRate (soeDEFAULT)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
LoanBrokerBuilder&
|
||||
setManagementFeeRate(std::decay_t<typename SF_UINT16::type::value_type> const& value)
|
||||
{
|
||||
object_[sfManagementFeeRate] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfOwnerCount (soeDEFAULT)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
LoanBrokerBuilder&
|
||||
setOwnerCount(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfOwnerCount] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfDebtTotal (soeDEFAULT)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
LoanBrokerBuilder&
|
||||
setDebtTotal(std::decay_t<typename SF_NUMBER::type::value_type> const& value)
|
||||
{
|
||||
object_[sfDebtTotal] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfDebtMaximum (soeDEFAULT)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
LoanBrokerBuilder&
|
||||
setDebtMaximum(std::decay_t<typename SF_NUMBER::type::value_type> const& value)
|
||||
{
|
||||
object_[sfDebtMaximum] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfCoverAvailable (soeDEFAULT)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
LoanBrokerBuilder&
|
||||
setCoverAvailable(std::decay_t<typename SF_NUMBER::type::value_type> const& value)
|
||||
{
|
||||
object_[sfCoverAvailable] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfCoverRateMinimum (soeDEFAULT)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
LoanBrokerBuilder&
|
||||
setCoverRateMinimum(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfCoverRateMinimum] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfCoverRateLiquidation (soeDEFAULT)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
LoanBrokerBuilder&
|
||||
setCoverRateLiquidation(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfCoverRateLiquidation] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build and return the completed LoanBroker wrapper.
|
||||
* @return The constructed ledger entry wrapper.
|
||||
* @throws std::runtime_error if the JSON cannot be parsed into a valid ledger entry.
|
||||
*/
|
||||
LoanBroker
|
||||
build(uint256 const& index)
|
||||
{
|
||||
return LoanBroker{SLE(object_, index)};
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::ledger_entries
|
||||
@@ -1,255 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STLedgerEntry.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/LedgerEntryBase.h>
|
||||
#include <xrpl/protocol_autogen/LedgerEntryBuilderBase.h>
|
||||
#include <xrpl/json/json_value.h>
|
||||
|
||||
#include <stdexcept>
|
||||
#include <optional>
|
||||
|
||||
namespace xrpl::ledger_entries {
|
||||
|
||||
// Forward declaration
|
||||
class MPTokenBuilder;
|
||||
|
||||
/**
|
||||
* Ledger Entry: MPToken
|
||||
* Type: ltMPTOKEN (0x007f)
|
||||
* RPC Name: mptoken
|
||||
*
|
||||
* Immutable wrapper around SLE providing type-safe field access.
|
||||
* Use MPTokenBuilder to construct new ledger entries.
|
||||
*/
|
||||
class MPToken : public LedgerEntryBase
|
||||
{
|
||||
public:
|
||||
static constexpr LedgerEntryType entryType = ltMPTOKEN;
|
||||
|
||||
/**
|
||||
* Construct a MPToken ledger entry wrapper from an existing SLE object.
|
||||
* @throws std::runtime_error if the ledger entry type doesn't match.
|
||||
*/
|
||||
explicit MPToken(SLE const& sle)
|
||||
: LedgerEntryBase(sle)
|
||||
{
|
||||
// Verify ledger entry type
|
||||
if (sle.getType() != entryType)
|
||||
{
|
||||
throw std::runtime_error("Invalid ledger entry type for MPToken");
|
||||
}
|
||||
}
|
||||
|
||||
// Ledger entry-specific field getters
|
||||
|
||||
/**
|
||||
* Get sfAccount (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_ACCOUNT::type::value_type
|
||||
getAccount() const
|
||||
{
|
||||
return this->sle_.at(sfAccount);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfMPTokenIssuanceID (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT192::type::value_type
|
||||
getMPTokenIssuanceID() const
|
||||
{
|
||||
return this->sle_.at(sfMPTokenIssuanceID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfMPTAmount (soeDEFAULT)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT64::type::value_type>
|
||||
getMPTAmount() const
|
||||
{
|
||||
if (hasMPTAmount())
|
||||
return this->sle_.at(sfMPTAmount);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasMPTAmount() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfMPTAmount);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfLockedAmount (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT64::type::value_type>
|
||||
getLockedAmount() const
|
||||
{
|
||||
if (hasLockedAmount())
|
||||
return this->sle_.at(sfLockedAmount);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasLockedAmount() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfLockedAmount);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfOwnerNode (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT64::type::value_type
|
||||
getOwnerNode() const
|
||||
{
|
||||
return this->sle_.at(sfOwnerNode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfPreviousTxnID (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT256::type::value_type
|
||||
getPreviousTxnID() const
|
||||
{
|
||||
return this->sle_.at(sfPreviousTxnID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfPreviousTxnLgrSeq (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT32::type::value_type
|
||||
getPreviousTxnLgrSeq() const
|
||||
{
|
||||
return this->sle_.at(sfPreviousTxnLgrSeq);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Builder for MPToken ledger entries.
|
||||
* Provides a fluent interface for constructing ledger entries with method chaining.
|
||||
* Uses Json::Value internally for flexible ledger entry construction.
|
||||
* Inherits common field setters from LedgerEntryBuilderBase.
|
||||
*/
|
||||
class MPTokenBuilder : public LedgerEntryBuilderBase<MPTokenBuilder>
|
||||
{
|
||||
public:
|
||||
MPTokenBuilder(std::decay_t<typename SF_ACCOUNT::type::value_type> const& account,std::decay_t<typename SF_UINT192::type::value_type> const& mPTokenIssuanceID,std::decay_t<typename SF_UINT64::type::value_type> const& ownerNode,std::decay_t<typename SF_UINT256::type::value_type> const& previousTxnID,std::decay_t<typename SF_UINT32::type::value_type> const& previousTxnLgrSeq)
|
||||
: LedgerEntryBuilderBase<MPTokenBuilder>(ltMPTOKEN)
|
||||
{
|
||||
setAccount(account);
|
||||
setMPTokenIssuanceID(mPTokenIssuanceID);
|
||||
setOwnerNode(ownerNode);
|
||||
setPreviousTxnID(previousTxnID);
|
||||
setPreviousTxnLgrSeq(previousTxnLgrSeq);
|
||||
}
|
||||
|
||||
MPTokenBuilder(SLE const& sle)
|
||||
{
|
||||
if (sle[sfLedgerEntryType] != ltMPTOKEN)
|
||||
{
|
||||
throw std::runtime_error("Invalid ledger entry type for MPToken");
|
||||
}
|
||||
object_ = sle;
|
||||
}
|
||||
|
||||
// Ledger entry-specific field setters
|
||||
|
||||
/**
|
||||
* Set sfAccount (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
MPTokenBuilder&
|
||||
setAccount(std::decay_t<typename SF_ACCOUNT::type::value_type> const& value)
|
||||
{
|
||||
object_[sfAccount] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfMPTokenIssuanceID (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
MPTokenBuilder&
|
||||
setMPTokenIssuanceID(std::decay_t<typename SF_UINT192::type::value_type> const& value)
|
||||
{
|
||||
object_[sfMPTokenIssuanceID] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfMPTAmount (soeDEFAULT)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
MPTokenBuilder&
|
||||
setMPTAmount(std::decay_t<typename SF_UINT64::type::value_type> const& value)
|
||||
{
|
||||
object_[sfMPTAmount] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfLockedAmount (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
MPTokenBuilder&
|
||||
setLockedAmount(std::decay_t<typename SF_UINT64::type::value_type> const& value)
|
||||
{
|
||||
object_[sfLockedAmount] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfOwnerNode (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
MPTokenBuilder&
|
||||
setOwnerNode(std::decay_t<typename SF_UINT64::type::value_type> const& value)
|
||||
{
|
||||
object_[sfOwnerNode] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfPreviousTxnID (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
MPTokenBuilder&
|
||||
setPreviousTxnID(std::decay_t<typename SF_UINT256::type::value_type> const& value)
|
||||
{
|
||||
object_[sfPreviousTxnID] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfPreviousTxnLgrSeq (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
MPTokenBuilder&
|
||||
setPreviousTxnLgrSeq(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfPreviousTxnLgrSeq] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build and return the completed MPToken wrapper.
|
||||
* @return The constructed ledger entry wrapper.
|
||||
* @throws std::runtime_error if the JSON cannot be parsed into a valid ledger entry.
|
||||
*/
|
||||
MPToken
|
||||
build(uint256 const& index)
|
||||
{
|
||||
return MPToken{SLE(object_, index)};
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::ledger_entries
|
||||
@@ -1,427 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STLedgerEntry.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/LedgerEntryBase.h>
|
||||
#include <xrpl/protocol_autogen/LedgerEntryBuilderBase.h>
|
||||
#include <xrpl/json/json_value.h>
|
||||
|
||||
#include <stdexcept>
|
||||
#include <optional>
|
||||
|
||||
namespace xrpl::ledger_entries {
|
||||
|
||||
// Forward declaration
|
||||
class MPTokenIssuanceBuilder;
|
||||
|
||||
/**
|
||||
* Ledger Entry: MPTokenIssuance
|
||||
* Type: ltMPTOKEN_ISSUANCE (0x007e)
|
||||
* RPC Name: mpt_issuance
|
||||
*
|
||||
* Immutable wrapper around SLE providing type-safe field access.
|
||||
* Use MPTokenIssuanceBuilder to construct new ledger entries.
|
||||
*/
|
||||
class MPTokenIssuance : public LedgerEntryBase
|
||||
{
|
||||
public:
|
||||
static constexpr LedgerEntryType entryType = ltMPTOKEN_ISSUANCE;
|
||||
|
||||
/**
|
||||
* Construct a MPTokenIssuance ledger entry wrapper from an existing SLE object.
|
||||
* @throws std::runtime_error if the ledger entry type doesn't match.
|
||||
*/
|
||||
explicit MPTokenIssuance(SLE const& sle)
|
||||
: LedgerEntryBase(sle)
|
||||
{
|
||||
// Verify ledger entry type
|
||||
if (sle.getType() != entryType)
|
||||
{
|
||||
throw std::runtime_error("Invalid ledger entry type for MPTokenIssuance");
|
||||
}
|
||||
}
|
||||
|
||||
// Ledger entry-specific field getters
|
||||
|
||||
/**
|
||||
* Get sfIssuer (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_ACCOUNT::type::value_type
|
||||
getIssuer() const
|
||||
{
|
||||
return this->sle_.at(sfIssuer);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfSequence (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT32::type::value_type
|
||||
getSequence() const
|
||||
{
|
||||
return this->sle_.at(sfSequence);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfTransferFee (soeDEFAULT)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT16::type::value_type>
|
||||
getTransferFee() const
|
||||
{
|
||||
if (hasTransferFee())
|
||||
return this->sle_.at(sfTransferFee);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasTransferFee() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfTransferFee);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfOwnerNode (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT64::type::value_type
|
||||
getOwnerNode() const
|
||||
{
|
||||
return this->sle_.at(sfOwnerNode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfAssetScale (soeDEFAULT)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT8::type::value_type>
|
||||
getAssetScale() const
|
||||
{
|
||||
if (hasAssetScale())
|
||||
return this->sle_.at(sfAssetScale);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasAssetScale() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfAssetScale);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfMaximumAmount (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT64::type::value_type>
|
||||
getMaximumAmount() const
|
||||
{
|
||||
if (hasMaximumAmount())
|
||||
return this->sle_.at(sfMaximumAmount);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasMaximumAmount() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfMaximumAmount);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfOutstandingAmount (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT64::type::value_type
|
||||
getOutstandingAmount() const
|
||||
{
|
||||
return this->sle_.at(sfOutstandingAmount);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfLockedAmount (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT64::type::value_type>
|
||||
getLockedAmount() const
|
||||
{
|
||||
if (hasLockedAmount())
|
||||
return this->sle_.at(sfLockedAmount);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasLockedAmount() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfLockedAmount);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfMPTokenMetadata (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_VL::type::value_type>
|
||||
getMPTokenMetadata() const
|
||||
{
|
||||
if (hasMPTokenMetadata())
|
||||
return this->sle_.at(sfMPTokenMetadata);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasMPTokenMetadata() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfMPTokenMetadata);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfPreviousTxnID (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT256::type::value_type
|
||||
getPreviousTxnID() const
|
||||
{
|
||||
return this->sle_.at(sfPreviousTxnID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfPreviousTxnLgrSeq (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT32::type::value_type
|
||||
getPreviousTxnLgrSeq() const
|
||||
{
|
||||
return this->sle_.at(sfPreviousTxnLgrSeq);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfDomainID (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT256::type::value_type>
|
||||
getDomainID() const
|
||||
{
|
||||
if (hasDomainID())
|
||||
return this->sle_.at(sfDomainID);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasDomainID() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfDomainID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfMutableFlags (soeDEFAULT)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT32::type::value_type>
|
||||
getMutableFlags() const
|
||||
{
|
||||
if (hasMutableFlags())
|
||||
return this->sle_.at(sfMutableFlags);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasMutableFlags() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfMutableFlags);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Builder for MPTokenIssuance ledger entries.
|
||||
* Provides a fluent interface for constructing ledger entries with method chaining.
|
||||
* Uses Json::Value internally for flexible ledger entry construction.
|
||||
* Inherits common field setters from LedgerEntryBuilderBase.
|
||||
*/
|
||||
class MPTokenIssuanceBuilder : public LedgerEntryBuilderBase<MPTokenIssuanceBuilder>
|
||||
{
|
||||
public:
|
||||
MPTokenIssuanceBuilder(std::decay_t<typename SF_ACCOUNT::type::value_type> const& issuer,std::decay_t<typename SF_UINT32::type::value_type> const& sequence,std::decay_t<typename SF_UINT64::type::value_type> const& ownerNode,std::decay_t<typename SF_UINT64::type::value_type> const& outstandingAmount,std::decay_t<typename SF_UINT256::type::value_type> const& previousTxnID,std::decay_t<typename SF_UINT32::type::value_type> const& previousTxnLgrSeq)
|
||||
: LedgerEntryBuilderBase<MPTokenIssuanceBuilder>(ltMPTOKEN_ISSUANCE)
|
||||
{
|
||||
setIssuer(issuer);
|
||||
setSequence(sequence);
|
||||
setOwnerNode(ownerNode);
|
||||
setOutstandingAmount(outstandingAmount);
|
||||
setPreviousTxnID(previousTxnID);
|
||||
setPreviousTxnLgrSeq(previousTxnLgrSeq);
|
||||
}
|
||||
|
||||
MPTokenIssuanceBuilder(SLE const& sle)
|
||||
{
|
||||
if (sle[sfLedgerEntryType] != ltMPTOKEN_ISSUANCE)
|
||||
{
|
||||
throw std::runtime_error("Invalid ledger entry type for MPTokenIssuance");
|
||||
}
|
||||
object_ = sle;
|
||||
}
|
||||
|
||||
// Ledger entry-specific field setters
|
||||
|
||||
/**
|
||||
* Set sfIssuer (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
MPTokenIssuanceBuilder&
|
||||
setIssuer(std::decay_t<typename SF_ACCOUNT::type::value_type> const& value)
|
||||
{
|
||||
object_[sfIssuer] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfSequence (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
MPTokenIssuanceBuilder&
|
||||
setSequence(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfSequence] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfTransferFee (soeDEFAULT)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
MPTokenIssuanceBuilder&
|
||||
setTransferFee(std::decay_t<typename SF_UINT16::type::value_type> const& value)
|
||||
{
|
||||
object_[sfTransferFee] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfOwnerNode (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
MPTokenIssuanceBuilder&
|
||||
setOwnerNode(std::decay_t<typename SF_UINT64::type::value_type> const& value)
|
||||
{
|
||||
object_[sfOwnerNode] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfAssetScale (soeDEFAULT)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
MPTokenIssuanceBuilder&
|
||||
setAssetScale(std::decay_t<typename SF_UINT8::type::value_type> const& value)
|
||||
{
|
||||
object_[sfAssetScale] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfMaximumAmount (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
MPTokenIssuanceBuilder&
|
||||
setMaximumAmount(std::decay_t<typename SF_UINT64::type::value_type> const& value)
|
||||
{
|
||||
object_[sfMaximumAmount] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfOutstandingAmount (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
MPTokenIssuanceBuilder&
|
||||
setOutstandingAmount(std::decay_t<typename SF_UINT64::type::value_type> const& value)
|
||||
{
|
||||
object_[sfOutstandingAmount] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfLockedAmount (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
MPTokenIssuanceBuilder&
|
||||
setLockedAmount(std::decay_t<typename SF_UINT64::type::value_type> const& value)
|
||||
{
|
||||
object_[sfLockedAmount] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfMPTokenMetadata (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
MPTokenIssuanceBuilder&
|
||||
setMPTokenMetadata(std::decay_t<typename SF_VL::type::value_type> const& value)
|
||||
{
|
||||
object_[sfMPTokenMetadata] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfPreviousTxnID (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
MPTokenIssuanceBuilder&
|
||||
setPreviousTxnID(std::decay_t<typename SF_UINT256::type::value_type> const& value)
|
||||
{
|
||||
object_[sfPreviousTxnID] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfPreviousTxnLgrSeq (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
MPTokenIssuanceBuilder&
|
||||
setPreviousTxnLgrSeq(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfPreviousTxnLgrSeq] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfDomainID (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
MPTokenIssuanceBuilder&
|
||||
setDomainID(std::decay_t<typename SF_UINT256::type::value_type> const& value)
|
||||
{
|
||||
object_[sfDomainID] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfMutableFlags (soeDEFAULT)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
MPTokenIssuanceBuilder&
|
||||
setMutableFlags(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfMutableFlags] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build and return the completed MPTokenIssuance wrapper.
|
||||
* @return The constructed ledger entry wrapper.
|
||||
* @throws std::runtime_error if the JSON cannot be parsed into a valid ledger entry.
|
||||
*/
|
||||
MPTokenIssuance
|
||||
build(uint256 const& index)
|
||||
{
|
||||
return MPTokenIssuance{SLE(object_, index)};
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::ledger_entries
|
||||
@@ -1,299 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STLedgerEntry.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/LedgerEntryBase.h>
|
||||
#include <xrpl/protocol_autogen/LedgerEntryBuilderBase.h>
|
||||
#include <xrpl/json/json_value.h>
|
||||
|
||||
#include <stdexcept>
|
||||
#include <optional>
|
||||
|
||||
namespace xrpl::ledger_entries {
|
||||
|
||||
// Forward declaration
|
||||
class NFTokenOfferBuilder;
|
||||
|
||||
/**
|
||||
* Ledger Entry: NFTokenOffer
|
||||
* Type: ltNFTOKEN_OFFER (0x0037)
|
||||
* RPC Name: nft_offer
|
||||
*
|
||||
* Immutable wrapper around SLE providing type-safe field access.
|
||||
* Use NFTokenOfferBuilder to construct new ledger entries.
|
||||
*/
|
||||
class NFTokenOffer : public LedgerEntryBase
|
||||
{
|
||||
public:
|
||||
static constexpr LedgerEntryType entryType = ltNFTOKEN_OFFER;
|
||||
|
||||
/**
|
||||
* Construct a NFTokenOffer ledger entry wrapper from an existing SLE object.
|
||||
* @throws std::runtime_error if the ledger entry type doesn't match.
|
||||
*/
|
||||
explicit NFTokenOffer(SLE const& sle)
|
||||
: LedgerEntryBase(sle)
|
||||
{
|
||||
// Verify ledger entry type
|
||||
if (sle.getType() != entryType)
|
||||
{
|
||||
throw std::runtime_error("Invalid ledger entry type for NFTokenOffer");
|
||||
}
|
||||
}
|
||||
|
||||
// Ledger entry-specific field getters
|
||||
|
||||
/**
|
||||
* Get sfOwner (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_ACCOUNT::type::value_type
|
||||
getOwner() const
|
||||
{
|
||||
return this->sle_.at(sfOwner);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfNFTokenID (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT256::type::value_type
|
||||
getNFTokenID() const
|
||||
{
|
||||
return this->sle_.at(sfNFTokenID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfAmount (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_AMOUNT::type::value_type
|
||||
getAmount() const
|
||||
{
|
||||
return this->sle_.at(sfAmount);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfOwnerNode (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT64::type::value_type
|
||||
getOwnerNode() const
|
||||
{
|
||||
return this->sle_.at(sfOwnerNode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfNFTokenOfferNode (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT64::type::value_type
|
||||
getNFTokenOfferNode() const
|
||||
{
|
||||
return this->sle_.at(sfNFTokenOfferNode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfDestination (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_ACCOUNT::type::value_type>
|
||||
getDestination() const
|
||||
{
|
||||
if (hasDestination())
|
||||
return this->sle_.at(sfDestination);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasDestination() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfDestination);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfExpiration (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT32::type::value_type>
|
||||
getExpiration() const
|
||||
{
|
||||
if (hasExpiration())
|
||||
return this->sle_.at(sfExpiration);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasExpiration() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfExpiration);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfPreviousTxnID (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT256::type::value_type
|
||||
getPreviousTxnID() const
|
||||
{
|
||||
return this->sle_.at(sfPreviousTxnID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfPreviousTxnLgrSeq (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT32::type::value_type
|
||||
getPreviousTxnLgrSeq() const
|
||||
{
|
||||
return this->sle_.at(sfPreviousTxnLgrSeq);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Builder for NFTokenOffer ledger entries.
|
||||
* Provides a fluent interface for constructing ledger entries with method chaining.
|
||||
* Uses Json::Value internally for flexible ledger entry construction.
|
||||
* Inherits common field setters from LedgerEntryBuilderBase.
|
||||
*/
|
||||
class NFTokenOfferBuilder : public LedgerEntryBuilderBase<NFTokenOfferBuilder>
|
||||
{
|
||||
public:
|
||||
NFTokenOfferBuilder(std::decay_t<typename SF_ACCOUNT::type::value_type> const& owner,std::decay_t<typename SF_UINT256::type::value_type> const& nFTokenID,std::decay_t<typename SF_AMOUNT::type::value_type> const& amount,std::decay_t<typename SF_UINT64::type::value_type> const& ownerNode,std::decay_t<typename SF_UINT64::type::value_type> const& nFTokenOfferNode,std::decay_t<typename SF_UINT256::type::value_type> const& previousTxnID,std::decay_t<typename SF_UINT32::type::value_type> const& previousTxnLgrSeq)
|
||||
: LedgerEntryBuilderBase<NFTokenOfferBuilder>(ltNFTOKEN_OFFER)
|
||||
{
|
||||
setOwner(owner);
|
||||
setNFTokenID(nFTokenID);
|
||||
setAmount(amount);
|
||||
setOwnerNode(ownerNode);
|
||||
setNFTokenOfferNode(nFTokenOfferNode);
|
||||
setPreviousTxnID(previousTxnID);
|
||||
setPreviousTxnLgrSeq(previousTxnLgrSeq);
|
||||
}
|
||||
|
||||
NFTokenOfferBuilder(SLE const& sle)
|
||||
{
|
||||
if (sle[sfLedgerEntryType] != ltNFTOKEN_OFFER)
|
||||
{
|
||||
throw std::runtime_error("Invalid ledger entry type for NFTokenOffer");
|
||||
}
|
||||
object_ = sle;
|
||||
}
|
||||
|
||||
// Ledger entry-specific field setters
|
||||
|
||||
/**
|
||||
* Set sfOwner (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
NFTokenOfferBuilder&
|
||||
setOwner(std::decay_t<typename SF_ACCOUNT::type::value_type> const& value)
|
||||
{
|
||||
object_[sfOwner] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfNFTokenID (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
NFTokenOfferBuilder&
|
||||
setNFTokenID(std::decay_t<typename SF_UINT256::type::value_type> const& value)
|
||||
{
|
||||
object_[sfNFTokenID] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfAmount (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
NFTokenOfferBuilder&
|
||||
setAmount(std::decay_t<typename SF_AMOUNT::type::value_type> const& value)
|
||||
{
|
||||
object_[sfAmount] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfOwnerNode (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
NFTokenOfferBuilder&
|
||||
setOwnerNode(std::decay_t<typename SF_UINT64::type::value_type> const& value)
|
||||
{
|
||||
object_[sfOwnerNode] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfNFTokenOfferNode (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
NFTokenOfferBuilder&
|
||||
setNFTokenOfferNode(std::decay_t<typename SF_UINT64::type::value_type> const& value)
|
||||
{
|
||||
object_[sfNFTokenOfferNode] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfDestination (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
NFTokenOfferBuilder&
|
||||
setDestination(std::decay_t<typename SF_ACCOUNT::type::value_type> const& value)
|
||||
{
|
||||
object_[sfDestination] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfExpiration (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
NFTokenOfferBuilder&
|
||||
setExpiration(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfExpiration] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfPreviousTxnID (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
NFTokenOfferBuilder&
|
||||
setPreviousTxnID(std::decay_t<typename SF_UINT256::type::value_type> const& value)
|
||||
{
|
||||
object_[sfPreviousTxnID] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfPreviousTxnLgrSeq (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
NFTokenOfferBuilder&
|
||||
setPreviousTxnLgrSeq(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfPreviousTxnLgrSeq] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build and return the completed NFTokenOffer wrapper.
|
||||
* @return The constructed ledger entry wrapper.
|
||||
* @throws std::runtime_error if the JSON cannot be parsed into a valid ledger entry.
|
||||
*/
|
||||
NFTokenOffer
|
||||
build(uint256 const& index)
|
||||
{
|
||||
return NFTokenOffer{SLE(object_, index)};
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::ledger_entries
|
||||
@@ -1,212 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STLedgerEntry.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/LedgerEntryBase.h>
|
||||
#include <xrpl/protocol_autogen/LedgerEntryBuilderBase.h>
|
||||
#include <xrpl/json/json_value.h>
|
||||
|
||||
#include <stdexcept>
|
||||
#include <optional>
|
||||
|
||||
namespace xrpl::ledger_entries {
|
||||
|
||||
// Forward declaration
|
||||
class NFTokenPageBuilder;
|
||||
|
||||
/**
|
||||
* Ledger Entry: NFTokenPage
|
||||
* Type: ltNFTOKEN_PAGE (0x0050)
|
||||
* RPC Name: nft_page
|
||||
*
|
||||
* Immutable wrapper around SLE providing type-safe field access.
|
||||
* Use NFTokenPageBuilder to construct new ledger entries.
|
||||
*/
|
||||
class NFTokenPage : public LedgerEntryBase
|
||||
{
|
||||
public:
|
||||
static constexpr LedgerEntryType entryType = ltNFTOKEN_PAGE;
|
||||
|
||||
/**
|
||||
* Construct a NFTokenPage ledger entry wrapper from an existing SLE object.
|
||||
* @throws std::runtime_error if the ledger entry type doesn't match.
|
||||
*/
|
||||
explicit NFTokenPage(SLE const& sle)
|
||||
: LedgerEntryBase(sle)
|
||||
{
|
||||
// Verify ledger entry type
|
||||
if (sle.getType() != entryType)
|
||||
{
|
||||
throw std::runtime_error("Invalid ledger entry type for NFTokenPage");
|
||||
}
|
||||
}
|
||||
|
||||
// Ledger entry-specific field getters
|
||||
|
||||
/**
|
||||
* Get sfPreviousPageMin (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT256::type::value_type>
|
||||
getPreviousPageMin() const
|
||||
{
|
||||
if (hasPreviousPageMin())
|
||||
return this->sle_.at(sfPreviousPageMin);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasPreviousPageMin() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfPreviousPageMin);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfNextPageMin (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT256::type::value_type>
|
||||
getNextPageMin() const
|
||||
{
|
||||
if (hasNextPageMin())
|
||||
return this->sle_.at(sfNextPageMin);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasNextPageMin() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfNextPageMin);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfNFTokens (soeREQUIRED)
|
||||
* Note: This is an untyped field (unknown).
|
||||
*/
|
||||
[[nodiscard]]
|
||||
STArray const&
|
||||
getNFTokens() const
|
||||
{
|
||||
return this->sle_.getFieldArray(sfNFTokens);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfPreviousTxnID (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT256::type::value_type
|
||||
getPreviousTxnID() const
|
||||
{
|
||||
return this->sle_.at(sfPreviousTxnID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfPreviousTxnLgrSeq (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT32::type::value_type
|
||||
getPreviousTxnLgrSeq() const
|
||||
{
|
||||
return this->sle_.at(sfPreviousTxnLgrSeq);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Builder for NFTokenPage ledger entries.
|
||||
* Provides a fluent interface for constructing ledger entries with method chaining.
|
||||
* Uses Json::Value internally for flexible ledger entry construction.
|
||||
* Inherits common field setters from LedgerEntryBuilderBase.
|
||||
*/
|
||||
class NFTokenPageBuilder : public LedgerEntryBuilderBase<NFTokenPageBuilder>
|
||||
{
|
||||
public:
|
||||
NFTokenPageBuilder(STArray const& nFTokens,std::decay_t<typename SF_UINT256::type::value_type> const& previousTxnID,std::decay_t<typename SF_UINT32::type::value_type> const& previousTxnLgrSeq)
|
||||
: LedgerEntryBuilderBase<NFTokenPageBuilder>(ltNFTOKEN_PAGE)
|
||||
{
|
||||
setNFTokens(nFTokens);
|
||||
setPreviousTxnID(previousTxnID);
|
||||
setPreviousTxnLgrSeq(previousTxnLgrSeq);
|
||||
}
|
||||
|
||||
NFTokenPageBuilder(SLE const& sle)
|
||||
{
|
||||
if (sle[sfLedgerEntryType] != ltNFTOKEN_PAGE)
|
||||
{
|
||||
throw std::runtime_error("Invalid ledger entry type for NFTokenPage");
|
||||
}
|
||||
object_ = sle;
|
||||
}
|
||||
|
||||
// Ledger entry-specific field setters
|
||||
|
||||
/**
|
||||
* Set sfPreviousPageMin (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
NFTokenPageBuilder&
|
||||
setPreviousPageMin(std::decay_t<typename SF_UINT256::type::value_type> const& value)
|
||||
{
|
||||
object_[sfPreviousPageMin] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfNextPageMin (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
NFTokenPageBuilder&
|
||||
setNextPageMin(std::decay_t<typename SF_UINT256::type::value_type> const& value)
|
||||
{
|
||||
object_[sfNextPageMin] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfNFTokens (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
NFTokenPageBuilder&
|
||||
setNFTokens(STArray const& value)
|
||||
{
|
||||
object_.setFieldArray(sfNFTokens, value);
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfPreviousTxnID (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
NFTokenPageBuilder&
|
||||
setPreviousTxnID(std::decay_t<typename SF_UINT256::type::value_type> const& value)
|
||||
{
|
||||
object_[sfPreviousTxnID] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfPreviousTxnLgrSeq (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
NFTokenPageBuilder&
|
||||
setPreviousTxnLgrSeq(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfPreviousTxnLgrSeq] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build and return the completed NFTokenPage wrapper.
|
||||
* @return The constructed ledger entry wrapper.
|
||||
* @throws std::runtime_error if the JSON cannot be parsed into a valid ledger entry.
|
||||
*/
|
||||
NFTokenPage
|
||||
build(uint256 const& index)
|
||||
{
|
||||
return NFTokenPage{SLE(object_, index)};
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::ledger_entries
|
||||
@@ -1,236 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STLedgerEntry.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/LedgerEntryBase.h>
|
||||
#include <xrpl/protocol_autogen/LedgerEntryBuilderBase.h>
|
||||
#include <xrpl/json/json_value.h>
|
||||
|
||||
#include <stdexcept>
|
||||
#include <optional>
|
||||
|
||||
namespace xrpl::ledger_entries {
|
||||
|
||||
// Forward declaration
|
||||
class NegativeUNLBuilder;
|
||||
|
||||
/**
|
||||
* Ledger Entry: NegativeUNL
|
||||
* Type: ltNEGATIVE_UNL (0x004e)
|
||||
* RPC Name: nunl
|
||||
*
|
||||
* Immutable wrapper around SLE providing type-safe field access.
|
||||
* Use NegativeUNLBuilder to construct new ledger entries.
|
||||
*/
|
||||
class NegativeUNL : public LedgerEntryBase
|
||||
{
|
||||
public:
|
||||
static constexpr LedgerEntryType entryType = ltNEGATIVE_UNL;
|
||||
|
||||
/**
|
||||
* Construct a NegativeUNL ledger entry wrapper from an existing SLE object.
|
||||
* @throws std::runtime_error if the ledger entry type doesn't match.
|
||||
*/
|
||||
explicit NegativeUNL(SLE const& sle)
|
||||
: LedgerEntryBase(sle)
|
||||
{
|
||||
// Verify ledger entry type
|
||||
if (sle.getType() != entryType)
|
||||
{
|
||||
throw std::runtime_error("Invalid ledger entry type for NegativeUNL");
|
||||
}
|
||||
}
|
||||
|
||||
// Ledger entry-specific field getters
|
||||
|
||||
/**
|
||||
* Get sfDisabledValidators (soeOPTIONAL)
|
||||
* Note: This is an untyped field (unknown).
|
||||
*/
|
||||
[[nodiscard]]
|
||||
std::optional<std::reference_wrapper<STArray const>>
|
||||
getDisabledValidators() const
|
||||
{
|
||||
if (this->sle_.isFieldPresent(sfDisabledValidators))
|
||||
return this->sle_.getFieldArray(sfDisabledValidators);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasDisabledValidators() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfDisabledValidators);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfValidatorToDisable (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_VL::type::value_type>
|
||||
getValidatorToDisable() const
|
||||
{
|
||||
if (hasValidatorToDisable())
|
||||
return this->sle_.at(sfValidatorToDisable);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasValidatorToDisable() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfValidatorToDisable);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfValidatorToReEnable (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_VL::type::value_type>
|
||||
getValidatorToReEnable() const
|
||||
{
|
||||
if (hasValidatorToReEnable())
|
||||
return this->sle_.at(sfValidatorToReEnable);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasValidatorToReEnable() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfValidatorToReEnable);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfPreviousTxnID (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT256::type::value_type>
|
||||
getPreviousTxnID() const
|
||||
{
|
||||
if (hasPreviousTxnID())
|
||||
return this->sle_.at(sfPreviousTxnID);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasPreviousTxnID() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfPreviousTxnID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfPreviousTxnLgrSeq (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT32::type::value_type>
|
||||
getPreviousTxnLgrSeq() const
|
||||
{
|
||||
if (hasPreviousTxnLgrSeq())
|
||||
return this->sle_.at(sfPreviousTxnLgrSeq);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasPreviousTxnLgrSeq() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfPreviousTxnLgrSeq);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Builder for NegativeUNL ledger entries.
|
||||
* Provides a fluent interface for constructing ledger entries with method chaining.
|
||||
* Uses Json::Value internally for flexible ledger entry construction.
|
||||
* Inherits common field setters from LedgerEntryBuilderBase.
|
||||
*/
|
||||
class NegativeUNLBuilder : public LedgerEntryBuilderBase<NegativeUNLBuilder>
|
||||
{
|
||||
public:
|
||||
NegativeUNLBuilder()
|
||||
: LedgerEntryBuilderBase<NegativeUNLBuilder>(ltNEGATIVE_UNL)
|
||||
{
|
||||
}
|
||||
|
||||
NegativeUNLBuilder(SLE const& sle)
|
||||
{
|
||||
if (sle[sfLedgerEntryType] != ltNEGATIVE_UNL)
|
||||
{
|
||||
throw std::runtime_error("Invalid ledger entry type for NegativeUNL");
|
||||
}
|
||||
object_ = sle;
|
||||
}
|
||||
|
||||
// Ledger entry-specific field setters
|
||||
|
||||
/**
|
||||
* Set sfDisabledValidators (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
NegativeUNLBuilder&
|
||||
setDisabledValidators(STArray const& value)
|
||||
{
|
||||
object_.setFieldArray(sfDisabledValidators, value);
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfValidatorToDisable (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
NegativeUNLBuilder&
|
||||
setValidatorToDisable(std::decay_t<typename SF_VL::type::value_type> const& value)
|
||||
{
|
||||
object_[sfValidatorToDisable] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfValidatorToReEnable (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
NegativeUNLBuilder&
|
||||
setValidatorToReEnable(std::decay_t<typename SF_VL::type::value_type> const& value)
|
||||
{
|
||||
object_[sfValidatorToReEnable] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfPreviousTxnID (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
NegativeUNLBuilder&
|
||||
setPreviousTxnID(std::decay_t<typename SF_UINT256::type::value_type> const& value)
|
||||
{
|
||||
object_[sfPreviousTxnID] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfPreviousTxnLgrSeq (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
NegativeUNLBuilder&
|
||||
setPreviousTxnLgrSeq(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfPreviousTxnLgrSeq] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build and return the completed NegativeUNL wrapper.
|
||||
* @return The constructed ledger entry wrapper.
|
||||
* @throws std::runtime_error if the JSON cannot be parsed into a valid ledger entry.
|
||||
*/
|
||||
NegativeUNL
|
||||
build(uint256 const& index)
|
||||
{
|
||||
return NegativeUNL{SLE(object_, index)};
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::ledger_entries
|
||||
@@ -1,374 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STLedgerEntry.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/LedgerEntryBase.h>
|
||||
#include <xrpl/protocol_autogen/LedgerEntryBuilderBase.h>
|
||||
#include <xrpl/json/json_value.h>
|
||||
|
||||
#include <stdexcept>
|
||||
#include <optional>
|
||||
|
||||
namespace xrpl::ledger_entries {
|
||||
|
||||
// Forward declaration
|
||||
class OfferBuilder;
|
||||
|
||||
/**
|
||||
* Ledger Entry: Offer
|
||||
* Type: ltOFFER (0x006f)
|
||||
* RPC Name: offer
|
||||
*
|
||||
* Immutable wrapper around SLE providing type-safe field access.
|
||||
* Use OfferBuilder to construct new ledger entries.
|
||||
*/
|
||||
class Offer : public LedgerEntryBase
|
||||
{
|
||||
public:
|
||||
static constexpr LedgerEntryType entryType = ltOFFER;
|
||||
|
||||
/**
|
||||
* Construct a Offer ledger entry wrapper from an existing SLE object.
|
||||
* @throws std::runtime_error if the ledger entry type doesn't match.
|
||||
*/
|
||||
explicit Offer(SLE const& sle)
|
||||
: LedgerEntryBase(sle)
|
||||
{
|
||||
// Verify ledger entry type
|
||||
if (sle.getType() != entryType)
|
||||
{
|
||||
throw std::runtime_error("Invalid ledger entry type for Offer");
|
||||
}
|
||||
}
|
||||
|
||||
// Ledger entry-specific field getters
|
||||
|
||||
/**
|
||||
* Get sfAccount (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_ACCOUNT::type::value_type
|
||||
getAccount() const
|
||||
{
|
||||
return this->sle_.at(sfAccount);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfSequence (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT32::type::value_type
|
||||
getSequence() const
|
||||
{
|
||||
return this->sle_.at(sfSequence);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfTakerPays (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_AMOUNT::type::value_type
|
||||
getTakerPays() const
|
||||
{
|
||||
return this->sle_.at(sfTakerPays);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfTakerGets (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_AMOUNT::type::value_type
|
||||
getTakerGets() const
|
||||
{
|
||||
return this->sle_.at(sfTakerGets);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfBookDirectory (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT256::type::value_type
|
||||
getBookDirectory() const
|
||||
{
|
||||
return this->sle_.at(sfBookDirectory);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfBookNode (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT64::type::value_type
|
||||
getBookNode() const
|
||||
{
|
||||
return this->sle_.at(sfBookNode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfOwnerNode (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT64::type::value_type
|
||||
getOwnerNode() const
|
||||
{
|
||||
return this->sle_.at(sfOwnerNode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfPreviousTxnID (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT256::type::value_type
|
||||
getPreviousTxnID() const
|
||||
{
|
||||
return this->sle_.at(sfPreviousTxnID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfPreviousTxnLgrSeq (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT32::type::value_type
|
||||
getPreviousTxnLgrSeq() const
|
||||
{
|
||||
return this->sle_.at(sfPreviousTxnLgrSeq);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfExpiration (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT32::type::value_type>
|
||||
getExpiration() const
|
||||
{
|
||||
if (hasExpiration())
|
||||
return this->sle_.at(sfExpiration);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasExpiration() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfExpiration);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfDomainID (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT256::type::value_type>
|
||||
getDomainID() const
|
||||
{
|
||||
if (hasDomainID())
|
||||
return this->sle_.at(sfDomainID);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasDomainID() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfDomainID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfAdditionalBooks (soeOPTIONAL)
|
||||
* Note: This is an untyped field (unknown).
|
||||
*/
|
||||
[[nodiscard]]
|
||||
std::optional<std::reference_wrapper<STArray const>>
|
||||
getAdditionalBooks() const
|
||||
{
|
||||
if (this->sle_.isFieldPresent(sfAdditionalBooks))
|
||||
return this->sle_.getFieldArray(sfAdditionalBooks);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasAdditionalBooks() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfAdditionalBooks);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Builder for Offer ledger entries.
|
||||
* Provides a fluent interface for constructing ledger entries with method chaining.
|
||||
* Uses Json::Value internally for flexible ledger entry construction.
|
||||
* Inherits common field setters from LedgerEntryBuilderBase.
|
||||
*/
|
||||
class OfferBuilder : public LedgerEntryBuilderBase<OfferBuilder>
|
||||
{
|
||||
public:
|
||||
OfferBuilder(std::decay_t<typename SF_ACCOUNT::type::value_type> const& account,std::decay_t<typename SF_UINT32::type::value_type> const& sequence,std::decay_t<typename SF_AMOUNT::type::value_type> const& takerPays,std::decay_t<typename SF_AMOUNT::type::value_type> const& takerGets,std::decay_t<typename SF_UINT256::type::value_type> const& bookDirectory,std::decay_t<typename SF_UINT64::type::value_type> const& bookNode,std::decay_t<typename SF_UINT64::type::value_type> const& ownerNode,std::decay_t<typename SF_UINT256::type::value_type> const& previousTxnID,std::decay_t<typename SF_UINT32::type::value_type> const& previousTxnLgrSeq)
|
||||
: LedgerEntryBuilderBase<OfferBuilder>(ltOFFER)
|
||||
{
|
||||
setAccount(account);
|
||||
setSequence(sequence);
|
||||
setTakerPays(takerPays);
|
||||
setTakerGets(takerGets);
|
||||
setBookDirectory(bookDirectory);
|
||||
setBookNode(bookNode);
|
||||
setOwnerNode(ownerNode);
|
||||
setPreviousTxnID(previousTxnID);
|
||||
setPreviousTxnLgrSeq(previousTxnLgrSeq);
|
||||
}
|
||||
|
||||
OfferBuilder(SLE const& sle)
|
||||
{
|
||||
if (sle[sfLedgerEntryType] != ltOFFER)
|
||||
{
|
||||
throw std::runtime_error("Invalid ledger entry type for Offer");
|
||||
}
|
||||
object_ = sle;
|
||||
}
|
||||
|
||||
// Ledger entry-specific field setters
|
||||
|
||||
/**
|
||||
* Set sfAccount (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
OfferBuilder&
|
||||
setAccount(std::decay_t<typename SF_ACCOUNT::type::value_type> const& value)
|
||||
{
|
||||
object_[sfAccount] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfSequence (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
OfferBuilder&
|
||||
setSequence(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfSequence] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfTakerPays (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
OfferBuilder&
|
||||
setTakerPays(std::decay_t<typename SF_AMOUNT::type::value_type> const& value)
|
||||
{
|
||||
object_[sfTakerPays] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfTakerGets (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
OfferBuilder&
|
||||
setTakerGets(std::decay_t<typename SF_AMOUNT::type::value_type> const& value)
|
||||
{
|
||||
object_[sfTakerGets] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfBookDirectory (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
OfferBuilder&
|
||||
setBookDirectory(std::decay_t<typename SF_UINT256::type::value_type> const& value)
|
||||
{
|
||||
object_[sfBookDirectory] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfBookNode (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
OfferBuilder&
|
||||
setBookNode(std::decay_t<typename SF_UINT64::type::value_type> const& value)
|
||||
{
|
||||
object_[sfBookNode] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfOwnerNode (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
OfferBuilder&
|
||||
setOwnerNode(std::decay_t<typename SF_UINT64::type::value_type> const& value)
|
||||
{
|
||||
object_[sfOwnerNode] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfPreviousTxnID (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
OfferBuilder&
|
||||
setPreviousTxnID(std::decay_t<typename SF_UINT256::type::value_type> const& value)
|
||||
{
|
||||
object_[sfPreviousTxnID] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfPreviousTxnLgrSeq (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
OfferBuilder&
|
||||
setPreviousTxnLgrSeq(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfPreviousTxnLgrSeq] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfExpiration (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
OfferBuilder&
|
||||
setExpiration(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfExpiration] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfDomainID (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
OfferBuilder&
|
||||
setDomainID(std::decay_t<typename SF_UINT256::type::value_type> const& value)
|
||||
{
|
||||
object_[sfDomainID] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfAdditionalBooks (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
OfferBuilder&
|
||||
setAdditionalBooks(STArray const& value)
|
||||
{
|
||||
object_.setFieldArray(sfAdditionalBooks, value);
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build and return the completed Offer wrapper.
|
||||
* @return The constructed ledger entry wrapper.
|
||||
* @throws std::runtime_error if the JSON cannot be parsed into a valid ledger entry.
|
||||
*/
|
||||
Offer
|
||||
build(uint256 const& index)
|
||||
{
|
||||
return Offer{SLE(object_, index)};
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::ledger_entries
|
||||
@@ -1,322 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STLedgerEntry.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/LedgerEntryBase.h>
|
||||
#include <xrpl/protocol_autogen/LedgerEntryBuilderBase.h>
|
||||
#include <xrpl/json/json_value.h>
|
||||
|
||||
#include <stdexcept>
|
||||
#include <optional>
|
||||
|
||||
namespace xrpl::ledger_entries {
|
||||
|
||||
// Forward declaration
|
||||
class OracleBuilder;
|
||||
|
||||
/**
|
||||
* Ledger Entry: Oracle
|
||||
* Type: ltORACLE (0x0080)
|
||||
* RPC Name: oracle
|
||||
*
|
||||
* Immutable wrapper around SLE providing type-safe field access.
|
||||
* Use OracleBuilder to construct new ledger entries.
|
||||
*/
|
||||
class Oracle : public LedgerEntryBase
|
||||
{
|
||||
public:
|
||||
static constexpr LedgerEntryType entryType = ltORACLE;
|
||||
|
||||
/**
|
||||
* Construct a Oracle ledger entry wrapper from an existing SLE object.
|
||||
* @throws std::runtime_error if the ledger entry type doesn't match.
|
||||
*/
|
||||
explicit Oracle(SLE const& sle)
|
||||
: LedgerEntryBase(sle)
|
||||
{
|
||||
// Verify ledger entry type
|
||||
if (sle.getType() != entryType)
|
||||
{
|
||||
throw std::runtime_error("Invalid ledger entry type for Oracle");
|
||||
}
|
||||
}
|
||||
|
||||
// Ledger entry-specific field getters
|
||||
|
||||
/**
|
||||
* Get sfOwner (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_ACCOUNT::type::value_type
|
||||
getOwner() const
|
||||
{
|
||||
return this->sle_.at(sfOwner);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfOracleDocumentID (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT32::type::value_type>
|
||||
getOracleDocumentID() const
|
||||
{
|
||||
if (hasOracleDocumentID())
|
||||
return this->sle_.at(sfOracleDocumentID);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasOracleDocumentID() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfOracleDocumentID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfProvider (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_VL::type::value_type
|
||||
getProvider() const
|
||||
{
|
||||
return this->sle_.at(sfProvider);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfPriceDataSeries (soeREQUIRED)
|
||||
* Note: This is an untyped field (unknown).
|
||||
*/
|
||||
[[nodiscard]]
|
||||
STArray const&
|
||||
getPriceDataSeries() const
|
||||
{
|
||||
return this->sle_.getFieldArray(sfPriceDataSeries);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfAssetClass (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_VL::type::value_type
|
||||
getAssetClass() const
|
||||
{
|
||||
return this->sle_.at(sfAssetClass);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfLastUpdateTime (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT32::type::value_type
|
||||
getLastUpdateTime() const
|
||||
{
|
||||
return this->sle_.at(sfLastUpdateTime);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfURI (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_VL::type::value_type>
|
||||
getURI() const
|
||||
{
|
||||
if (hasURI())
|
||||
return this->sle_.at(sfURI);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasURI() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfURI);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfOwnerNode (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT64::type::value_type
|
||||
getOwnerNode() const
|
||||
{
|
||||
return this->sle_.at(sfOwnerNode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfPreviousTxnID (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT256::type::value_type
|
||||
getPreviousTxnID() const
|
||||
{
|
||||
return this->sle_.at(sfPreviousTxnID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfPreviousTxnLgrSeq (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT32::type::value_type
|
||||
getPreviousTxnLgrSeq() const
|
||||
{
|
||||
return this->sle_.at(sfPreviousTxnLgrSeq);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Builder for Oracle ledger entries.
|
||||
* Provides a fluent interface for constructing ledger entries with method chaining.
|
||||
* Uses Json::Value internally for flexible ledger entry construction.
|
||||
* Inherits common field setters from LedgerEntryBuilderBase.
|
||||
*/
|
||||
class OracleBuilder : public LedgerEntryBuilderBase<OracleBuilder>
|
||||
{
|
||||
public:
|
||||
OracleBuilder(std::decay_t<typename SF_ACCOUNT::type::value_type> const& owner,std::decay_t<typename SF_VL::type::value_type> const& provider,STArray const& priceDataSeries,std::decay_t<typename SF_VL::type::value_type> const& assetClass,std::decay_t<typename SF_UINT32::type::value_type> const& lastUpdateTime,std::decay_t<typename SF_UINT64::type::value_type> const& ownerNode,std::decay_t<typename SF_UINT256::type::value_type> const& previousTxnID,std::decay_t<typename SF_UINT32::type::value_type> const& previousTxnLgrSeq)
|
||||
: LedgerEntryBuilderBase<OracleBuilder>(ltORACLE)
|
||||
{
|
||||
setOwner(owner);
|
||||
setProvider(provider);
|
||||
setPriceDataSeries(priceDataSeries);
|
||||
setAssetClass(assetClass);
|
||||
setLastUpdateTime(lastUpdateTime);
|
||||
setOwnerNode(ownerNode);
|
||||
setPreviousTxnID(previousTxnID);
|
||||
setPreviousTxnLgrSeq(previousTxnLgrSeq);
|
||||
}
|
||||
|
||||
OracleBuilder(SLE const& sle)
|
||||
{
|
||||
if (sle[sfLedgerEntryType] != ltORACLE)
|
||||
{
|
||||
throw std::runtime_error("Invalid ledger entry type for Oracle");
|
||||
}
|
||||
object_ = sle;
|
||||
}
|
||||
|
||||
// Ledger entry-specific field setters
|
||||
|
||||
/**
|
||||
* Set sfOwner (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
OracleBuilder&
|
||||
setOwner(std::decay_t<typename SF_ACCOUNT::type::value_type> const& value)
|
||||
{
|
||||
object_[sfOwner] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfOracleDocumentID (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
OracleBuilder&
|
||||
setOracleDocumentID(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfOracleDocumentID] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfProvider (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
OracleBuilder&
|
||||
setProvider(std::decay_t<typename SF_VL::type::value_type> const& value)
|
||||
{
|
||||
object_[sfProvider] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfPriceDataSeries (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
OracleBuilder&
|
||||
setPriceDataSeries(STArray const& value)
|
||||
{
|
||||
object_.setFieldArray(sfPriceDataSeries, value);
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfAssetClass (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
OracleBuilder&
|
||||
setAssetClass(std::decay_t<typename SF_VL::type::value_type> const& value)
|
||||
{
|
||||
object_[sfAssetClass] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfLastUpdateTime (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
OracleBuilder&
|
||||
setLastUpdateTime(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfLastUpdateTime] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfURI (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
OracleBuilder&
|
||||
setURI(std::decay_t<typename SF_VL::type::value_type> const& value)
|
||||
{
|
||||
object_[sfURI] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfOwnerNode (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
OracleBuilder&
|
||||
setOwnerNode(std::decay_t<typename SF_UINT64::type::value_type> const& value)
|
||||
{
|
||||
object_[sfOwnerNode] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfPreviousTxnID (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
OracleBuilder&
|
||||
setPreviousTxnID(std::decay_t<typename SF_UINT256::type::value_type> const& value)
|
||||
{
|
||||
object_[sfPreviousTxnID] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfPreviousTxnLgrSeq (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
OracleBuilder&
|
||||
setPreviousTxnLgrSeq(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfPreviousTxnLgrSeq] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build and return the completed Oracle wrapper.
|
||||
* @return The constructed ledger entry wrapper.
|
||||
* @throws std::runtime_error if the JSON cannot be parsed into a valid ledger entry.
|
||||
*/
|
||||
Oracle
|
||||
build(uint256 const& index)
|
||||
{
|
||||
return Oracle{SLE(object_, index)};
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::ledger_entries
|
||||
@@ -1,463 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STLedgerEntry.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/LedgerEntryBase.h>
|
||||
#include <xrpl/protocol_autogen/LedgerEntryBuilderBase.h>
|
||||
#include <xrpl/json/json_value.h>
|
||||
|
||||
#include <stdexcept>
|
||||
#include <optional>
|
||||
|
||||
namespace xrpl::ledger_entries {
|
||||
|
||||
// Forward declaration
|
||||
class PayChannelBuilder;
|
||||
|
||||
/**
|
||||
* Ledger Entry: PayChannel
|
||||
* Type: ltPAYCHAN (0x0078)
|
||||
* RPC Name: payment_channel
|
||||
*
|
||||
* Immutable wrapper around SLE providing type-safe field access.
|
||||
* Use PayChannelBuilder to construct new ledger entries.
|
||||
*/
|
||||
class PayChannel : public LedgerEntryBase
|
||||
{
|
||||
public:
|
||||
static constexpr LedgerEntryType entryType = ltPAYCHAN;
|
||||
|
||||
/**
|
||||
* Construct a PayChannel ledger entry wrapper from an existing SLE object.
|
||||
* @throws std::runtime_error if the ledger entry type doesn't match.
|
||||
*/
|
||||
explicit PayChannel(SLE const& sle)
|
||||
: LedgerEntryBase(sle)
|
||||
{
|
||||
// Verify ledger entry type
|
||||
if (sle.getType() != entryType)
|
||||
{
|
||||
throw std::runtime_error("Invalid ledger entry type for PayChannel");
|
||||
}
|
||||
}
|
||||
|
||||
// Ledger entry-specific field getters
|
||||
|
||||
/**
|
||||
* Get sfAccount (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_ACCOUNT::type::value_type
|
||||
getAccount() const
|
||||
{
|
||||
return this->sle_.at(sfAccount);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfDestination (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_ACCOUNT::type::value_type
|
||||
getDestination() const
|
||||
{
|
||||
return this->sle_.at(sfDestination);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfSequence (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT32::type::value_type>
|
||||
getSequence() const
|
||||
{
|
||||
if (hasSequence())
|
||||
return this->sle_.at(sfSequence);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasSequence() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfSequence);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfAmount (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_AMOUNT::type::value_type
|
||||
getAmount() const
|
||||
{
|
||||
return this->sle_.at(sfAmount);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfBalance (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_AMOUNT::type::value_type
|
||||
getBalance() const
|
||||
{
|
||||
return this->sle_.at(sfBalance);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfPublicKey (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_VL::type::value_type
|
||||
getPublicKey() const
|
||||
{
|
||||
return this->sle_.at(sfPublicKey);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfSettleDelay (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT32::type::value_type
|
||||
getSettleDelay() const
|
||||
{
|
||||
return this->sle_.at(sfSettleDelay);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfExpiration (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT32::type::value_type>
|
||||
getExpiration() const
|
||||
{
|
||||
if (hasExpiration())
|
||||
return this->sle_.at(sfExpiration);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasExpiration() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfExpiration);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfCancelAfter (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT32::type::value_type>
|
||||
getCancelAfter() const
|
||||
{
|
||||
if (hasCancelAfter())
|
||||
return this->sle_.at(sfCancelAfter);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasCancelAfter() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfCancelAfter);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfSourceTag (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT32::type::value_type>
|
||||
getSourceTag() const
|
||||
{
|
||||
if (hasSourceTag())
|
||||
return this->sle_.at(sfSourceTag);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasSourceTag() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfSourceTag);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfDestinationTag (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT32::type::value_type>
|
||||
getDestinationTag() const
|
||||
{
|
||||
if (hasDestinationTag())
|
||||
return this->sle_.at(sfDestinationTag);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasDestinationTag() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfDestinationTag);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfOwnerNode (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT64::type::value_type
|
||||
getOwnerNode() const
|
||||
{
|
||||
return this->sle_.at(sfOwnerNode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfPreviousTxnID (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT256::type::value_type
|
||||
getPreviousTxnID() const
|
||||
{
|
||||
return this->sle_.at(sfPreviousTxnID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfPreviousTxnLgrSeq (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT32::type::value_type
|
||||
getPreviousTxnLgrSeq() const
|
||||
{
|
||||
return this->sle_.at(sfPreviousTxnLgrSeq);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfDestinationNode (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT64::type::value_type>
|
||||
getDestinationNode() const
|
||||
{
|
||||
if (hasDestinationNode())
|
||||
return this->sle_.at(sfDestinationNode);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasDestinationNode() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfDestinationNode);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Builder for PayChannel ledger entries.
|
||||
* Provides a fluent interface for constructing ledger entries with method chaining.
|
||||
* Uses Json::Value internally for flexible ledger entry construction.
|
||||
* Inherits common field setters from LedgerEntryBuilderBase.
|
||||
*/
|
||||
class PayChannelBuilder : public LedgerEntryBuilderBase<PayChannelBuilder>
|
||||
{
|
||||
public:
|
||||
PayChannelBuilder(std::decay_t<typename SF_ACCOUNT::type::value_type> const& account,std::decay_t<typename SF_ACCOUNT::type::value_type> const& destination,std::decay_t<typename SF_AMOUNT::type::value_type> const& amount,std::decay_t<typename SF_AMOUNT::type::value_type> const& balance,std::decay_t<typename SF_VL::type::value_type> const& publicKey,std::decay_t<typename SF_UINT32::type::value_type> const& settleDelay,std::decay_t<typename SF_UINT64::type::value_type> const& ownerNode,std::decay_t<typename SF_UINT256::type::value_type> const& previousTxnID,std::decay_t<typename SF_UINT32::type::value_type> const& previousTxnLgrSeq)
|
||||
: LedgerEntryBuilderBase<PayChannelBuilder>(ltPAYCHAN)
|
||||
{
|
||||
setAccount(account);
|
||||
setDestination(destination);
|
||||
setAmount(amount);
|
||||
setBalance(balance);
|
||||
setPublicKey(publicKey);
|
||||
setSettleDelay(settleDelay);
|
||||
setOwnerNode(ownerNode);
|
||||
setPreviousTxnID(previousTxnID);
|
||||
setPreviousTxnLgrSeq(previousTxnLgrSeq);
|
||||
}
|
||||
|
||||
PayChannelBuilder(SLE const& sle)
|
||||
{
|
||||
if (sle[sfLedgerEntryType] != ltPAYCHAN)
|
||||
{
|
||||
throw std::runtime_error("Invalid ledger entry type for PayChannel");
|
||||
}
|
||||
object_ = sle;
|
||||
}
|
||||
|
||||
// Ledger entry-specific field setters
|
||||
|
||||
/**
|
||||
* Set sfAccount (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
PayChannelBuilder&
|
||||
setAccount(std::decay_t<typename SF_ACCOUNT::type::value_type> const& value)
|
||||
{
|
||||
object_[sfAccount] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfDestination (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
PayChannelBuilder&
|
||||
setDestination(std::decay_t<typename SF_ACCOUNT::type::value_type> const& value)
|
||||
{
|
||||
object_[sfDestination] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfSequence (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
PayChannelBuilder&
|
||||
setSequence(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfSequence] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfAmount (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
PayChannelBuilder&
|
||||
setAmount(std::decay_t<typename SF_AMOUNT::type::value_type> const& value)
|
||||
{
|
||||
object_[sfAmount] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfBalance (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
PayChannelBuilder&
|
||||
setBalance(std::decay_t<typename SF_AMOUNT::type::value_type> const& value)
|
||||
{
|
||||
object_[sfBalance] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfPublicKey (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
PayChannelBuilder&
|
||||
setPublicKey(std::decay_t<typename SF_VL::type::value_type> const& value)
|
||||
{
|
||||
object_[sfPublicKey] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfSettleDelay (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
PayChannelBuilder&
|
||||
setSettleDelay(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfSettleDelay] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfExpiration (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
PayChannelBuilder&
|
||||
setExpiration(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfExpiration] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfCancelAfter (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
PayChannelBuilder&
|
||||
setCancelAfter(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfCancelAfter] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfSourceTag (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
PayChannelBuilder&
|
||||
setSourceTag(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfSourceTag] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfDestinationTag (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
PayChannelBuilder&
|
||||
setDestinationTag(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfDestinationTag] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfOwnerNode (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
PayChannelBuilder&
|
||||
setOwnerNode(std::decay_t<typename SF_UINT64::type::value_type> const& value)
|
||||
{
|
||||
object_[sfOwnerNode] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfPreviousTxnID (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
PayChannelBuilder&
|
||||
setPreviousTxnID(std::decay_t<typename SF_UINT256::type::value_type> const& value)
|
||||
{
|
||||
object_[sfPreviousTxnID] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfPreviousTxnLgrSeq (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
PayChannelBuilder&
|
||||
setPreviousTxnLgrSeq(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfPreviousTxnLgrSeq] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfDestinationNode (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
PayChannelBuilder&
|
||||
setDestinationNode(std::decay_t<typename SF_UINT64::type::value_type> const& value)
|
||||
{
|
||||
object_[sfDestinationNode] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build and return the completed PayChannel wrapper.
|
||||
* @return The constructed ledger entry wrapper.
|
||||
* @throws std::runtime_error if the JSON cannot be parsed into a valid ledger entry.
|
||||
*/
|
||||
PayChannel
|
||||
build(uint256 const& index)
|
||||
{
|
||||
return PayChannel{SLE(object_, index)};
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::ledger_entries
|
||||
@@ -1,218 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STLedgerEntry.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/LedgerEntryBase.h>
|
||||
#include <xrpl/protocol_autogen/LedgerEntryBuilderBase.h>
|
||||
#include <xrpl/json/json_value.h>
|
||||
|
||||
#include <stdexcept>
|
||||
#include <optional>
|
||||
|
||||
namespace xrpl::ledger_entries {
|
||||
|
||||
// Forward declaration
|
||||
class PermissionedDomainBuilder;
|
||||
|
||||
/**
|
||||
* Ledger Entry: PermissionedDomain
|
||||
* Type: ltPERMISSIONED_DOMAIN (0x0082)
|
||||
* RPC Name: permissioned_domain
|
||||
*
|
||||
* Immutable wrapper around SLE providing type-safe field access.
|
||||
* Use PermissionedDomainBuilder to construct new ledger entries.
|
||||
*/
|
||||
class PermissionedDomain : public LedgerEntryBase
|
||||
{
|
||||
public:
|
||||
static constexpr LedgerEntryType entryType = ltPERMISSIONED_DOMAIN;
|
||||
|
||||
/**
|
||||
* Construct a PermissionedDomain ledger entry wrapper from an existing SLE object.
|
||||
* @throws std::runtime_error if the ledger entry type doesn't match.
|
||||
*/
|
||||
explicit PermissionedDomain(SLE const& sle)
|
||||
: LedgerEntryBase(sle)
|
||||
{
|
||||
// Verify ledger entry type
|
||||
if (sle.getType() != entryType)
|
||||
{
|
||||
throw std::runtime_error("Invalid ledger entry type for PermissionedDomain");
|
||||
}
|
||||
}
|
||||
|
||||
// Ledger entry-specific field getters
|
||||
|
||||
/**
|
||||
* Get sfOwner (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_ACCOUNT::type::value_type
|
||||
getOwner() const
|
||||
{
|
||||
return this->sle_.at(sfOwner);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfSequence (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT32::type::value_type
|
||||
getSequence() const
|
||||
{
|
||||
return this->sle_.at(sfSequence);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfAcceptedCredentials (soeREQUIRED)
|
||||
* Note: This is an untyped field (unknown).
|
||||
*/
|
||||
[[nodiscard]]
|
||||
STArray const&
|
||||
getAcceptedCredentials() const
|
||||
{
|
||||
return this->sle_.getFieldArray(sfAcceptedCredentials);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfOwnerNode (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT64::type::value_type
|
||||
getOwnerNode() const
|
||||
{
|
||||
return this->sle_.at(sfOwnerNode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfPreviousTxnID (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT256::type::value_type
|
||||
getPreviousTxnID() const
|
||||
{
|
||||
return this->sle_.at(sfPreviousTxnID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfPreviousTxnLgrSeq (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT32::type::value_type
|
||||
getPreviousTxnLgrSeq() const
|
||||
{
|
||||
return this->sle_.at(sfPreviousTxnLgrSeq);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Builder for PermissionedDomain ledger entries.
|
||||
* Provides a fluent interface for constructing ledger entries with method chaining.
|
||||
* Uses Json::Value internally for flexible ledger entry construction.
|
||||
* Inherits common field setters from LedgerEntryBuilderBase.
|
||||
*/
|
||||
class PermissionedDomainBuilder : public LedgerEntryBuilderBase<PermissionedDomainBuilder>
|
||||
{
|
||||
public:
|
||||
PermissionedDomainBuilder(std::decay_t<typename SF_ACCOUNT::type::value_type> const& owner,std::decay_t<typename SF_UINT32::type::value_type> const& sequence,STArray const& acceptedCredentials,std::decay_t<typename SF_UINT64::type::value_type> const& ownerNode,std::decay_t<typename SF_UINT256::type::value_type> const& previousTxnID,std::decay_t<typename SF_UINT32::type::value_type> const& previousTxnLgrSeq)
|
||||
: LedgerEntryBuilderBase<PermissionedDomainBuilder>(ltPERMISSIONED_DOMAIN)
|
||||
{
|
||||
setOwner(owner);
|
||||
setSequence(sequence);
|
||||
setAcceptedCredentials(acceptedCredentials);
|
||||
setOwnerNode(ownerNode);
|
||||
setPreviousTxnID(previousTxnID);
|
||||
setPreviousTxnLgrSeq(previousTxnLgrSeq);
|
||||
}
|
||||
|
||||
PermissionedDomainBuilder(SLE const& sle)
|
||||
{
|
||||
if (sle[sfLedgerEntryType] != ltPERMISSIONED_DOMAIN)
|
||||
{
|
||||
throw std::runtime_error("Invalid ledger entry type for PermissionedDomain");
|
||||
}
|
||||
object_ = sle;
|
||||
}
|
||||
|
||||
// Ledger entry-specific field setters
|
||||
|
||||
/**
|
||||
* Set sfOwner (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
PermissionedDomainBuilder&
|
||||
setOwner(std::decay_t<typename SF_ACCOUNT::type::value_type> const& value)
|
||||
{
|
||||
object_[sfOwner] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfSequence (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
PermissionedDomainBuilder&
|
||||
setSequence(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfSequence] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfAcceptedCredentials (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
PermissionedDomainBuilder&
|
||||
setAcceptedCredentials(STArray const& value)
|
||||
{
|
||||
object_.setFieldArray(sfAcceptedCredentials, value);
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfOwnerNode (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
PermissionedDomainBuilder&
|
||||
setOwnerNode(std::decay_t<typename SF_UINT64::type::value_type> const& value)
|
||||
{
|
||||
object_[sfOwnerNode] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfPreviousTxnID (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
PermissionedDomainBuilder&
|
||||
setPreviousTxnID(std::decay_t<typename SF_UINT256::type::value_type> const& value)
|
||||
{
|
||||
object_[sfPreviousTxnID] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfPreviousTxnLgrSeq (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
PermissionedDomainBuilder&
|
||||
setPreviousTxnLgrSeq(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfPreviousTxnLgrSeq] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build and return the completed PermissionedDomain wrapper.
|
||||
* @return The constructed ledger entry wrapper.
|
||||
* @throws std::runtime_error if the JSON cannot be parsed into a valid ledger entry.
|
||||
*/
|
||||
PermissionedDomain
|
||||
build(uint256 const& index)
|
||||
{
|
||||
return PermissionedDomain{SLE(object_, index)};
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::ledger_entries
|
||||
@@ -1,375 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STLedgerEntry.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/LedgerEntryBase.h>
|
||||
#include <xrpl/protocol_autogen/LedgerEntryBuilderBase.h>
|
||||
#include <xrpl/json/json_value.h>
|
||||
|
||||
#include <stdexcept>
|
||||
#include <optional>
|
||||
|
||||
namespace xrpl::ledger_entries {
|
||||
|
||||
// Forward declaration
|
||||
class RippleStateBuilder;
|
||||
|
||||
/**
|
||||
* Ledger Entry: RippleState
|
||||
* Type: ltRIPPLE_STATE (0x0072)
|
||||
* RPC Name: state
|
||||
*
|
||||
* Immutable wrapper around SLE providing type-safe field access.
|
||||
* Use RippleStateBuilder to construct new ledger entries.
|
||||
*/
|
||||
class RippleState : public LedgerEntryBase
|
||||
{
|
||||
public:
|
||||
static constexpr LedgerEntryType entryType = ltRIPPLE_STATE;
|
||||
|
||||
/**
|
||||
* Construct a RippleState ledger entry wrapper from an existing SLE object.
|
||||
* @throws std::runtime_error if the ledger entry type doesn't match.
|
||||
*/
|
||||
explicit RippleState(SLE const& sle)
|
||||
: LedgerEntryBase(sle)
|
||||
{
|
||||
// Verify ledger entry type
|
||||
if (sle.getType() != entryType)
|
||||
{
|
||||
throw std::runtime_error("Invalid ledger entry type for RippleState");
|
||||
}
|
||||
}
|
||||
|
||||
// Ledger entry-specific field getters
|
||||
|
||||
/**
|
||||
* Get sfBalance (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_AMOUNT::type::value_type
|
||||
getBalance() const
|
||||
{
|
||||
return this->sle_.at(sfBalance);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfLowLimit (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_AMOUNT::type::value_type
|
||||
getLowLimit() const
|
||||
{
|
||||
return this->sle_.at(sfLowLimit);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfHighLimit (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_AMOUNT::type::value_type
|
||||
getHighLimit() const
|
||||
{
|
||||
return this->sle_.at(sfHighLimit);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfPreviousTxnID (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT256::type::value_type
|
||||
getPreviousTxnID() const
|
||||
{
|
||||
return this->sle_.at(sfPreviousTxnID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfPreviousTxnLgrSeq (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT32::type::value_type
|
||||
getPreviousTxnLgrSeq() const
|
||||
{
|
||||
return this->sle_.at(sfPreviousTxnLgrSeq);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfLowNode (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT64::type::value_type>
|
||||
getLowNode() const
|
||||
{
|
||||
if (hasLowNode())
|
||||
return this->sle_.at(sfLowNode);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasLowNode() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfLowNode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfLowQualityIn (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT32::type::value_type>
|
||||
getLowQualityIn() const
|
||||
{
|
||||
if (hasLowQualityIn())
|
||||
return this->sle_.at(sfLowQualityIn);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasLowQualityIn() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfLowQualityIn);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfLowQualityOut (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT32::type::value_type>
|
||||
getLowQualityOut() const
|
||||
{
|
||||
if (hasLowQualityOut())
|
||||
return this->sle_.at(sfLowQualityOut);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasLowQualityOut() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfLowQualityOut);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfHighNode (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT64::type::value_type>
|
||||
getHighNode() const
|
||||
{
|
||||
if (hasHighNode())
|
||||
return this->sle_.at(sfHighNode);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasHighNode() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfHighNode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfHighQualityIn (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT32::type::value_type>
|
||||
getHighQualityIn() const
|
||||
{
|
||||
if (hasHighQualityIn())
|
||||
return this->sle_.at(sfHighQualityIn);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasHighQualityIn() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfHighQualityIn);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfHighQualityOut (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT32::type::value_type>
|
||||
getHighQualityOut() const
|
||||
{
|
||||
if (hasHighQualityOut())
|
||||
return this->sle_.at(sfHighQualityOut);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasHighQualityOut() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfHighQualityOut);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Builder for RippleState ledger entries.
|
||||
* Provides a fluent interface for constructing ledger entries with method chaining.
|
||||
* Uses Json::Value internally for flexible ledger entry construction.
|
||||
* Inherits common field setters from LedgerEntryBuilderBase.
|
||||
*/
|
||||
class RippleStateBuilder : public LedgerEntryBuilderBase<RippleStateBuilder>
|
||||
{
|
||||
public:
|
||||
RippleStateBuilder(std::decay_t<typename SF_AMOUNT::type::value_type> const& balance,std::decay_t<typename SF_AMOUNT::type::value_type> const& lowLimit,std::decay_t<typename SF_AMOUNT::type::value_type> const& highLimit,std::decay_t<typename SF_UINT256::type::value_type> const& previousTxnID,std::decay_t<typename SF_UINT32::type::value_type> const& previousTxnLgrSeq)
|
||||
: LedgerEntryBuilderBase<RippleStateBuilder>(ltRIPPLE_STATE)
|
||||
{
|
||||
setBalance(balance);
|
||||
setLowLimit(lowLimit);
|
||||
setHighLimit(highLimit);
|
||||
setPreviousTxnID(previousTxnID);
|
||||
setPreviousTxnLgrSeq(previousTxnLgrSeq);
|
||||
}
|
||||
|
||||
RippleStateBuilder(SLE const& sle)
|
||||
{
|
||||
if (sle[sfLedgerEntryType] != ltRIPPLE_STATE)
|
||||
{
|
||||
throw std::runtime_error("Invalid ledger entry type for RippleState");
|
||||
}
|
||||
object_ = sle;
|
||||
}
|
||||
|
||||
// Ledger entry-specific field setters
|
||||
|
||||
/**
|
||||
* Set sfBalance (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
RippleStateBuilder&
|
||||
setBalance(std::decay_t<typename SF_AMOUNT::type::value_type> const& value)
|
||||
{
|
||||
object_[sfBalance] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfLowLimit (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
RippleStateBuilder&
|
||||
setLowLimit(std::decay_t<typename SF_AMOUNT::type::value_type> const& value)
|
||||
{
|
||||
object_[sfLowLimit] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfHighLimit (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
RippleStateBuilder&
|
||||
setHighLimit(std::decay_t<typename SF_AMOUNT::type::value_type> const& value)
|
||||
{
|
||||
object_[sfHighLimit] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfPreviousTxnID (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
RippleStateBuilder&
|
||||
setPreviousTxnID(std::decay_t<typename SF_UINT256::type::value_type> const& value)
|
||||
{
|
||||
object_[sfPreviousTxnID] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfPreviousTxnLgrSeq (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
RippleStateBuilder&
|
||||
setPreviousTxnLgrSeq(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfPreviousTxnLgrSeq] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfLowNode (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
RippleStateBuilder&
|
||||
setLowNode(std::decay_t<typename SF_UINT64::type::value_type> const& value)
|
||||
{
|
||||
object_[sfLowNode] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfLowQualityIn (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
RippleStateBuilder&
|
||||
setLowQualityIn(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfLowQualityIn] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfLowQualityOut (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
RippleStateBuilder&
|
||||
setLowQualityOut(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfLowQualityOut] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfHighNode (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
RippleStateBuilder&
|
||||
setHighNode(std::decay_t<typename SF_UINT64::type::value_type> const& value)
|
||||
{
|
||||
object_[sfHighNode] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfHighQualityIn (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
RippleStateBuilder&
|
||||
setHighQualityIn(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfHighQualityIn] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfHighQualityOut (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
RippleStateBuilder&
|
||||
setHighQualityOut(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfHighQualityOut] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build and return the completed RippleState wrapper.
|
||||
* @return The constructed ledger entry wrapper.
|
||||
* @throws std::runtime_error if the JSON cannot be parsed into a valid ledger entry.
|
||||
*/
|
||||
RippleState
|
||||
build(uint256 const& index)
|
||||
{
|
||||
return RippleState{SLE(object_, index)};
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::ledger_entries
|
||||
@@ -1,248 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STLedgerEntry.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/LedgerEntryBase.h>
|
||||
#include <xrpl/protocol_autogen/LedgerEntryBuilderBase.h>
|
||||
#include <xrpl/json/json_value.h>
|
||||
|
||||
#include <stdexcept>
|
||||
#include <optional>
|
||||
|
||||
namespace xrpl::ledger_entries {
|
||||
|
||||
// Forward declaration
|
||||
class SignerListBuilder;
|
||||
|
||||
/**
|
||||
* Ledger Entry: SignerList
|
||||
* Type: ltSIGNER_LIST (0x0053)
|
||||
* RPC Name: signer_list
|
||||
*
|
||||
* Immutable wrapper around SLE providing type-safe field access.
|
||||
* Use SignerListBuilder to construct new ledger entries.
|
||||
*/
|
||||
class SignerList : public LedgerEntryBase
|
||||
{
|
||||
public:
|
||||
static constexpr LedgerEntryType entryType = ltSIGNER_LIST;
|
||||
|
||||
/**
|
||||
* Construct a SignerList ledger entry wrapper from an existing SLE object.
|
||||
* @throws std::runtime_error if the ledger entry type doesn't match.
|
||||
*/
|
||||
explicit SignerList(SLE const& sle)
|
||||
: LedgerEntryBase(sle)
|
||||
{
|
||||
// Verify ledger entry type
|
||||
if (sle.getType() != entryType)
|
||||
{
|
||||
throw std::runtime_error("Invalid ledger entry type for SignerList");
|
||||
}
|
||||
}
|
||||
|
||||
// Ledger entry-specific field getters
|
||||
|
||||
/**
|
||||
* Get sfOwner (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_ACCOUNT::type::value_type>
|
||||
getOwner() const
|
||||
{
|
||||
if (hasOwner())
|
||||
return this->sle_.at(sfOwner);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasOwner() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfOwner);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfOwnerNode (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT64::type::value_type
|
||||
getOwnerNode() const
|
||||
{
|
||||
return this->sle_.at(sfOwnerNode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfSignerQuorum (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT32::type::value_type
|
||||
getSignerQuorum() const
|
||||
{
|
||||
return this->sle_.at(sfSignerQuorum);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfSignerEntries (soeREQUIRED)
|
||||
* Note: This is an untyped field (unknown).
|
||||
*/
|
||||
[[nodiscard]]
|
||||
STArray const&
|
||||
getSignerEntries() const
|
||||
{
|
||||
return this->sle_.getFieldArray(sfSignerEntries);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfSignerListID (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT32::type::value_type
|
||||
getSignerListID() const
|
||||
{
|
||||
return this->sle_.at(sfSignerListID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfPreviousTxnID (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT256::type::value_type
|
||||
getPreviousTxnID() const
|
||||
{
|
||||
return this->sle_.at(sfPreviousTxnID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfPreviousTxnLgrSeq (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT32::type::value_type
|
||||
getPreviousTxnLgrSeq() const
|
||||
{
|
||||
return this->sle_.at(sfPreviousTxnLgrSeq);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Builder for SignerList ledger entries.
|
||||
* Provides a fluent interface for constructing ledger entries with method chaining.
|
||||
* Uses Json::Value internally for flexible ledger entry construction.
|
||||
* Inherits common field setters from LedgerEntryBuilderBase.
|
||||
*/
|
||||
class SignerListBuilder : public LedgerEntryBuilderBase<SignerListBuilder>
|
||||
{
|
||||
public:
|
||||
SignerListBuilder(std::decay_t<typename SF_UINT64::type::value_type> const& ownerNode,std::decay_t<typename SF_UINT32::type::value_type> const& signerQuorum,STArray const& signerEntries,std::decay_t<typename SF_UINT32::type::value_type> const& signerListID,std::decay_t<typename SF_UINT256::type::value_type> const& previousTxnID,std::decay_t<typename SF_UINT32::type::value_type> const& previousTxnLgrSeq)
|
||||
: LedgerEntryBuilderBase<SignerListBuilder>(ltSIGNER_LIST)
|
||||
{
|
||||
setOwnerNode(ownerNode);
|
||||
setSignerQuorum(signerQuorum);
|
||||
setSignerEntries(signerEntries);
|
||||
setSignerListID(signerListID);
|
||||
setPreviousTxnID(previousTxnID);
|
||||
setPreviousTxnLgrSeq(previousTxnLgrSeq);
|
||||
}
|
||||
|
||||
SignerListBuilder(SLE const& sle)
|
||||
{
|
||||
if (sle[sfLedgerEntryType] != ltSIGNER_LIST)
|
||||
{
|
||||
throw std::runtime_error("Invalid ledger entry type for SignerList");
|
||||
}
|
||||
object_ = sle;
|
||||
}
|
||||
|
||||
// Ledger entry-specific field setters
|
||||
|
||||
/**
|
||||
* Set sfOwner (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
SignerListBuilder&
|
||||
setOwner(std::decay_t<typename SF_ACCOUNT::type::value_type> const& value)
|
||||
{
|
||||
object_[sfOwner] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfOwnerNode (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
SignerListBuilder&
|
||||
setOwnerNode(std::decay_t<typename SF_UINT64::type::value_type> const& value)
|
||||
{
|
||||
object_[sfOwnerNode] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfSignerQuorum (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
SignerListBuilder&
|
||||
setSignerQuorum(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfSignerQuorum] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfSignerEntries (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
SignerListBuilder&
|
||||
setSignerEntries(STArray const& value)
|
||||
{
|
||||
object_.setFieldArray(sfSignerEntries, value);
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfSignerListID (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
SignerListBuilder&
|
||||
setSignerListID(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfSignerListID] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfPreviousTxnID (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
SignerListBuilder&
|
||||
setPreviousTxnID(std::decay_t<typename SF_UINT256::type::value_type> const& value)
|
||||
{
|
||||
object_[sfPreviousTxnID] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfPreviousTxnLgrSeq (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
SignerListBuilder&
|
||||
setPreviousTxnLgrSeq(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfPreviousTxnLgrSeq] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build and return the completed SignerList wrapper.
|
||||
* @return The constructed ledger entry wrapper.
|
||||
* @throws std::runtime_error if the JSON cannot be parsed into a valid ledger entry.
|
||||
*/
|
||||
SignerList
|
||||
build(uint256 const& index)
|
||||
{
|
||||
return SignerList{SLE(object_, index)};
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::ledger_entries
|
||||
@@ -1,195 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STLedgerEntry.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/LedgerEntryBase.h>
|
||||
#include <xrpl/protocol_autogen/LedgerEntryBuilderBase.h>
|
||||
#include <xrpl/json/json_value.h>
|
||||
|
||||
#include <stdexcept>
|
||||
#include <optional>
|
||||
|
||||
namespace xrpl::ledger_entries {
|
||||
|
||||
// Forward declaration
|
||||
class TicketBuilder;
|
||||
|
||||
/**
|
||||
* Ledger Entry: Ticket
|
||||
* Type: ltTICKET (0x0054)
|
||||
* RPC Name: ticket
|
||||
*
|
||||
* Immutable wrapper around SLE providing type-safe field access.
|
||||
* Use TicketBuilder to construct new ledger entries.
|
||||
*/
|
||||
class Ticket : public LedgerEntryBase
|
||||
{
|
||||
public:
|
||||
static constexpr LedgerEntryType entryType = ltTICKET;
|
||||
|
||||
/**
|
||||
* Construct a Ticket ledger entry wrapper from an existing SLE object.
|
||||
* @throws std::runtime_error if the ledger entry type doesn't match.
|
||||
*/
|
||||
explicit Ticket(SLE const& sle)
|
||||
: LedgerEntryBase(sle)
|
||||
{
|
||||
// Verify ledger entry type
|
||||
if (sle.getType() != entryType)
|
||||
{
|
||||
throw std::runtime_error("Invalid ledger entry type for Ticket");
|
||||
}
|
||||
}
|
||||
|
||||
// Ledger entry-specific field getters
|
||||
|
||||
/**
|
||||
* Get sfAccount (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_ACCOUNT::type::value_type
|
||||
getAccount() const
|
||||
{
|
||||
return this->sle_.at(sfAccount);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfOwnerNode (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT64::type::value_type
|
||||
getOwnerNode() const
|
||||
{
|
||||
return this->sle_.at(sfOwnerNode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfTicketSequence (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT32::type::value_type
|
||||
getTicketSequence() const
|
||||
{
|
||||
return this->sle_.at(sfTicketSequence);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfPreviousTxnID (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT256::type::value_type
|
||||
getPreviousTxnID() const
|
||||
{
|
||||
return this->sle_.at(sfPreviousTxnID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfPreviousTxnLgrSeq (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT32::type::value_type
|
||||
getPreviousTxnLgrSeq() const
|
||||
{
|
||||
return this->sle_.at(sfPreviousTxnLgrSeq);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Builder for Ticket ledger entries.
|
||||
* Provides a fluent interface for constructing ledger entries with method chaining.
|
||||
* Uses Json::Value internally for flexible ledger entry construction.
|
||||
* Inherits common field setters from LedgerEntryBuilderBase.
|
||||
*/
|
||||
class TicketBuilder : public LedgerEntryBuilderBase<TicketBuilder>
|
||||
{
|
||||
public:
|
||||
TicketBuilder(std::decay_t<typename SF_ACCOUNT::type::value_type> const& account,std::decay_t<typename SF_UINT64::type::value_type> const& ownerNode,std::decay_t<typename SF_UINT32::type::value_type> const& ticketSequence,std::decay_t<typename SF_UINT256::type::value_type> const& previousTxnID,std::decay_t<typename SF_UINT32::type::value_type> const& previousTxnLgrSeq)
|
||||
: LedgerEntryBuilderBase<TicketBuilder>(ltTICKET)
|
||||
{
|
||||
setAccount(account);
|
||||
setOwnerNode(ownerNode);
|
||||
setTicketSequence(ticketSequence);
|
||||
setPreviousTxnID(previousTxnID);
|
||||
setPreviousTxnLgrSeq(previousTxnLgrSeq);
|
||||
}
|
||||
|
||||
TicketBuilder(SLE const& sle)
|
||||
{
|
||||
if (sle[sfLedgerEntryType] != ltTICKET)
|
||||
{
|
||||
throw std::runtime_error("Invalid ledger entry type for Ticket");
|
||||
}
|
||||
object_ = sle;
|
||||
}
|
||||
|
||||
// Ledger entry-specific field setters
|
||||
|
||||
/**
|
||||
* Set sfAccount (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
TicketBuilder&
|
||||
setAccount(std::decay_t<typename SF_ACCOUNT::type::value_type> const& value)
|
||||
{
|
||||
object_[sfAccount] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfOwnerNode (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
TicketBuilder&
|
||||
setOwnerNode(std::decay_t<typename SF_UINT64::type::value_type> const& value)
|
||||
{
|
||||
object_[sfOwnerNode] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfTicketSequence (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
TicketBuilder&
|
||||
setTicketSequence(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfTicketSequence] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfPreviousTxnID (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
TicketBuilder&
|
||||
setPreviousTxnID(std::decay_t<typename SF_UINT256::type::value_type> const& value)
|
||||
{
|
||||
object_[sfPreviousTxnID] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfPreviousTxnLgrSeq (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
TicketBuilder&
|
||||
setPreviousTxnLgrSeq(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfPreviousTxnLgrSeq] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build and return the completed Ticket wrapper.
|
||||
* @return The constructed ledger entry wrapper.
|
||||
* @throws std::runtime_error if the JSON cannot be parsed into a valid ledger entry.
|
||||
*/
|
||||
Ticket
|
||||
build(uint256 const& index)
|
||||
{
|
||||
return Ticket{SLE(object_, index)};
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::ledger_entries
|
||||
@@ -1,463 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STLedgerEntry.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/LedgerEntryBase.h>
|
||||
#include <xrpl/protocol_autogen/LedgerEntryBuilderBase.h>
|
||||
#include <xrpl/json/json_value.h>
|
||||
|
||||
#include <stdexcept>
|
||||
#include <optional>
|
||||
|
||||
namespace xrpl::ledger_entries {
|
||||
|
||||
// Forward declaration
|
||||
class VaultBuilder;
|
||||
|
||||
/**
|
||||
* Ledger Entry: Vault
|
||||
* Type: ltVAULT (0x0084)
|
||||
* RPC Name: vault
|
||||
*
|
||||
* Immutable wrapper around SLE providing type-safe field access.
|
||||
* Use VaultBuilder to construct new ledger entries.
|
||||
*/
|
||||
class Vault : public LedgerEntryBase
|
||||
{
|
||||
public:
|
||||
static constexpr LedgerEntryType entryType = ltVAULT;
|
||||
|
||||
/**
|
||||
* Construct a Vault ledger entry wrapper from an existing SLE object.
|
||||
* @throws std::runtime_error if the ledger entry type doesn't match.
|
||||
*/
|
||||
explicit Vault(SLE const& sle)
|
||||
: LedgerEntryBase(sle)
|
||||
{
|
||||
// Verify ledger entry type
|
||||
if (sle.getType() != entryType)
|
||||
{
|
||||
throw std::runtime_error("Invalid ledger entry type for Vault");
|
||||
}
|
||||
}
|
||||
|
||||
// Ledger entry-specific field getters
|
||||
|
||||
/**
|
||||
* Get sfPreviousTxnID (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT256::type::value_type
|
||||
getPreviousTxnID() const
|
||||
{
|
||||
return this->sle_.at(sfPreviousTxnID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfPreviousTxnLgrSeq (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT32::type::value_type
|
||||
getPreviousTxnLgrSeq() const
|
||||
{
|
||||
return this->sle_.at(sfPreviousTxnLgrSeq);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfSequence (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT32::type::value_type
|
||||
getSequence() const
|
||||
{
|
||||
return this->sle_.at(sfSequence);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfOwnerNode (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT64::type::value_type
|
||||
getOwnerNode() const
|
||||
{
|
||||
return this->sle_.at(sfOwnerNode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfOwner (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_ACCOUNT::type::value_type
|
||||
getOwner() const
|
||||
{
|
||||
return this->sle_.at(sfOwner);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfAccount (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_ACCOUNT::type::value_type
|
||||
getAccount() const
|
||||
{
|
||||
return this->sle_.at(sfAccount);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfData (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_VL::type::value_type>
|
||||
getData() const
|
||||
{
|
||||
if (hasData())
|
||||
return this->sle_.at(sfData);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasData() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfData);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfAsset (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_ISSUE::type::value_type
|
||||
getAsset() const
|
||||
{
|
||||
return this->sle_.at(sfAsset);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfAssetsTotal (soeDEFAULT)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_NUMBER::type::value_type>
|
||||
getAssetsTotal() const
|
||||
{
|
||||
if (hasAssetsTotal())
|
||||
return this->sle_.at(sfAssetsTotal);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasAssetsTotal() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfAssetsTotal);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfAssetsAvailable (soeDEFAULT)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_NUMBER::type::value_type>
|
||||
getAssetsAvailable() const
|
||||
{
|
||||
if (hasAssetsAvailable())
|
||||
return this->sle_.at(sfAssetsAvailable);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasAssetsAvailable() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfAssetsAvailable);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfAssetsMaximum (soeDEFAULT)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_NUMBER::type::value_type>
|
||||
getAssetsMaximum() const
|
||||
{
|
||||
if (hasAssetsMaximum())
|
||||
return this->sle_.at(sfAssetsMaximum);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasAssetsMaximum() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfAssetsMaximum);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfLossUnrealized (soeDEFAULT)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_NUMBER::type::value_type>
|
||||
getLossUnrealized() const
|
||||
{
|
||||
if (hasLossUnrealized())
|
||||
return this->sle_.at(sfLossUnrealized);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasLossUnrealized() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfLossUnrealized);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfShareMPTID (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT192::type::value_type
|
||||
getShareMPTID() const
|
||||
{
|
||||
return this->sle_.at(sfShareMPTID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfWithdrawalPolicy (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT8::type::value_type
|
||||
getWithdrawalPolicy() const
|
||||
{
|
||||
return this->sle_.at(sfWithdrawalPolicy);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfScale (soeDEFAULT)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT8::type::value_type>
|
||||
getScale() const
|
||||
{
|
||||
if (hasScale())
|
||||
return this->sle_.at(sfScale);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasScale() const
|
||||
{
|
||||
return this->sle_.isFieldPresent(sfScale);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Builder for Vault ledger entries.
|
||||
* Provides a fluent interface for constructing ledger entries with method chaining.
|
||||
* Uses Json::Value internally for flexible ledger entry construction.
|
||||
* Inherits common field setters from LedgerEntryBuilderBase.
|
||||
*/
|
||||
class VaultBuilder : public LedgerEntryBuilderBase<VaultBuilder>
|
||||
{
|
||||
public:
|
||||
VaultBuilder(std::decay_t<typename SF_UINT256::type::value_type> const& previousTxnID,std::decay_t<typename SF_UINT32::type::value_type> const& previousTxnLgrSeq,std::decay_t<typename SF_UINT32::type::value_type> const& sequence,std::decay_t<typename SF_UINT64::type::value_type> const& ownerNode,std::decay_t<typename SF_ACCOUNT::type::value_type> const& owner,std::decay_t<typename SF_ACCOUNT::type::value_type> const& account,std::decay_t<typename SF_ISSUE::type::value_type> const& asset,std::decay_t<typename SF_UINT192::type::value_type> const& shareMPTID,std::decay_t<typename SF_UINT8::type::value_type> const& withdrawalPolicy)
|
||||
: LedgerEntryBuilderBase<VaultBuilder>(ltVAULT)
|
||||
{
|
||||
setPreviousTxnID(previousTxnID);
|
||||
setPreviousTxnLgrSeq(previousTxnLgrSeq);
|
||||
setSequence(sequence);
|
||||
setOwnerNode(ownerNode);
|
||||
setOwner(owner);
|
||||
setAccount(account);
|
||||
setAsset(asset);
|
||||
setShareMPTID(shareMPTID);
|
||||
setWithdrawalPolicy(withdrawalPolicy);
|
||||
}
|
||||
|
||||
VaultBuilder(SLE const& sle)
|
||||
{
|
||||
if (sle[sfLedgerEntryType] != ltVAULT)
|
||||
{
|
||||
throw std::runtime_error("Invalid ledger entry type for Vault");
|
||||
}
|
||||
object_ = sle;
|
||||
}
|
||||
|
||||
// Ledger entry-specific field setters
|
||||
|
||||
/**
|
||||
* Set sfPreviousTxnID (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
VaultBuilder&
|
||||
setPreviousTxnID(std::decay_t<typename SF_UINT256::type::value_type> const& value)
|
||||
{
|
||||
object_[sfPreviousTxnID] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfPreviousTxnLgrSeq (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
VaultBuilder&
|
||||
setPreviousTxnLgrSeq(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfPreviousTxnLgrSeq] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfSequence (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
VaultBuilder&
|
||||
setSequence(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfSequence] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfOwnerNode (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
VaultBuilder&
|
||||
setOwnerNode(std::decay_t<typename SF_UINT64::type::value_type> const& value)
|
||||
{
|
||||
object_[sfOwnerNode] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfOwner (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
VaultBuilder&
|
||||
setOwner(std::decay_t<typename SF_ACCOUNT::type::value_type> const& value)
|
||||
{
|
||||
object_[sfOwner] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfAccount (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
VaultBuilder&
|
||||
setAccount(std::decay_t<typename SF_ACCOUNT::type::value_type> const& value)
|
||||
{
|
||||
object_[sfAccount] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfData (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
VaultBuilder&
|
||||
setData(std::decay_t<typename SF_VL::type::value_type> const& value)
|
||||
{
|
||||
object_[sfData] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfAsset (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
VaultBuilder&
|
||||
setAsset(std::decay_t<typename SF_ISSUE::type::value_type> const& value)
|
||||
{
|
||||
object_[sfAsset] = STIssue(sfAsset, value);
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfAssetsTotal (soeDEFAULT)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
VaultBuilder&
|
||||
setAssetsTotal(std::decay_t<typename SF_NUMBER::type::value_type> const& value)
|
||||
{
|
||||
object_[sfAssetsTotal] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfAssetsAvailable (soeDEFAULT)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
VaultBuilder&
|
||||
setAssetsAvailable(std::decay_t<typename SF_NUMBER::type::value_type> const& value)
|
||||
{
|
||||
object_[sfAssetsAvailable] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfAssetsMaximum (soeDEFAULT)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
VaultBuilder&
|
||||
setAssetsMaximum(std::decay_t<typename SF_NUMBER::type::value_type> const& value)
|
||||
{
|
||||
object_[sfAssetsMaximum] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfLossUnrealized (soeDEFAULT)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
VaultBuilder&
|
||||
setLossUnrealized(std::decay_t<typename SF_NUMBER::type::value_type> const& value)
|
||||
{
|
||||
object_[sfLossUnrealized] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfShareMPTID (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
VaultBuilder&
|
||||
setShareMPTID(std::decay_t<typename SF_UINT192::type::value_type> const& value)
|
||||
{
|
||||
object_[sfShareMPTID] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfWithdrawalPolicy (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
VaultBuilder&
|
||||
setWithdrawalPolicy(std::decay_t<typename SF_UINT8::type::value_type> const& value)
|
||||
{
|
||||
object_[sfWithdrawalPolicy] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfScale (soeDEFAULT)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
VaultBuilder&
|
||||
setScale(std::decay_t<typename SF_UINT8::type::value_type> const& value)
|
||||
{
|
||||
object_[sfScale] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build and return the completed Vault wrapper.
|
||||
* @return The constructed ledger entry wrapper.
|
||||
* @throws std::runtime_error if the JSON cannot be parsed into a valid ledger entry.
|
||||
*/
|
||||
Vault
|
||||
build(uint256 const& index)
|
||||
{
|
||||
return Vault{SLE(object_, index)};
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::ledger_entries
|
||||
@@ -1,284 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STLedgerEntry.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/LedgerEntryBase.h>
|
||||
#include <xrpl/protocol_autogen/LedgerEntryBuilderBase.h>
|
||||
#include <xrpl/json/json_value.h>
|
||||
|
||||
#include <stdexcept>
|
||||
#include <optional>
|
||||
|
||||
namespace xrpl::ledger_entries {
|
||||
|
||||
// Forward declaration
|
||||
class XChainOwnedClaimIDBuilder;
|
||||
|
||||
/**
|
||||
* Ledger Entry: XChainOwnedClaimID
|
||||
* Type: ltXCHAIN_OWNED_CLAIM_ID (0x0071)
|
||||
* RPC Name: xchain_owned_claim_id
|
||||
*
|
||||
* Immutable wrapper around SLE providing type-safe field access.
|
||||
* Use XChainOwnedClaimIDBuilder to construct new ledger entries.
|
||||
*/
|
||||
class XChainOwnedClaimID : public LedgerEntryBase
|
||||
{
|
||||
public:
|
||||
static constexpr LedgerEntryType entryType = ltXCHAIN_OWNED_CLAIM_ID;
|
||||
|
||||
/**
|
||||
* Construct a XChainOwnedClaimID ledger entry wrapper from an existing SLE object.
|
||||
* @throws std::runtime_error if the ledger entry type doesn't match.
|
||||
*/
|
||||
explicit XChainOwnedClaimID(SLE const& sle)
|
||||
: LedgerEntryBase(sle)
|
||||
{
|
||||
// Verify ledger entry type
|
||||
if (sle.getType() != entryType)
|
||||
{
|
||||
throw std::runtime_error("Invalid ledger entry type for XChainOwnedClaimID");
|
||||
}
|
||||
}
|
||||
|
||||
// Ledger entry-specific field getters
|
||||
|
||||
/**
|
||||
* Get sfAccount (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_ACCOUNT::type::value_type
|
||||
getAccount() const
|
||||
{
|
||||
return this->sle_.at(sfAccount);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfXChainBridge (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_XCHAIN_BRIDGE::type::value_type
|
||||
getXChainBridge() const
|
||||
{
|
||||
return this->sle_.at(sfXChainBridge);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfXChainClaimID (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT64::type::value_type
|
||||
getXChainClaimID() const
|
||||
{
|
||||
return this->sle_.at(sfXChainClaimID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfOtherChainSource (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_ACCOUNT::type::value_type
|
||||
getOtherChainSource() const
|
||||
{
|
||||
return this->sle_.at(sfOtherChainSource);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfXChainClaimAttestations (soeREQUIRED)
|
||||
* Note: This is an untyped field (unknown).
|
||||
*/
|
||||
[[nodiscard]]
|
||||
STArray const&
|
||||
getXChainClaimAttestations() const
|
||||
{
|
||||
return this->sle_.getFieldArray(sfXChainClaimAttestations);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfSignatureReward (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_AMOUNT::type::value_type
|
||||
getSignatureReward() const
|
||||
{
|
||||
return this->sle_.at(sfSignatureReward);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfOwnerNode (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT64::type::value_type
|
||||
getOwnerNode() const
|
||||
{
|
||||
return this->sle_.at(sfOwnerNode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfPreviousTxnID (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT256::type::value_type
|
||||
getPreviousTxnID() const
|
||||
{
|
||||
return this->sle_.at(sfPreviousTxnID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfPreviousTxnLgrSeq (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT32::type::value_type
|
||||
getPreviousTxnLgrSeq() const
|
||||
{
|
||||
return this->sle_.at(sfPreviousTxnLgrSeq);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Builder for XChainOwnedClaimID ledger entries.
|
||||
* Provides a fluent interface for constructing ledger entries with method chaining.
|
||||
* Uses Json::Value internally for flexible ledger entry construction.
|
||||
* Inherits common field setters from LedgerEntryBuilderBase.
|
||||
*/
|
||||
class XChainOwnedClaimIDBuilder : public LedgerEntryBuilderBase<XChainOwnedClaimIDBuilder>
|
||||
{
|
||||
public:
|
||||
XChainOwnedClaimIDBuilder(std::decay_t<typename SF_ACCOUNT::type::value_type> const& account,std::decay_t<typename SF_XCHAIN_BRIDGE::type::value_type> const& xChainBridge,std::decay_t<typename SF_UINT64::type::value_type> const& xChainClaimID,std::decay_t<typename SF_ACCOUNT::type::value_type> const& otherChainSource,STArray const& xChainClaimAttestations,std::decay_t<typename SF_AMOUNT::type::value_type> const& signatureReward,std::decay_t<typename SF_UINT64::type::value_type> const& ownerNode,std::decay_t<typename SF_UINT256::type::value_type> const& previousTxnID,std::decay_t<typename SF_UINT32::type::value_type> const& previousTxnLgrSeq)
|
||||
: LedgerEntryBuilderBase<XChainOwnedClaimIDBuilder>(ltXCHAIN_OWNED_CLAIM_ID)
|
||||
{
|
||||
setAccount(account);
|
||||
setXChainBridge(xChainBridge);
|
||||
setXChainClaimID(xChainClaimID);
|
||||
setOtherChainSource(otherChainSource);
|
||||
setXChainClaimAttestations(xChainClaimAttestations);
|
||||
setSignatureReward(signatureReward);
|
||||
setOwnerNode(ownerNode);
|
||||
setPreviousTxnID(previousTxnID);
|
||||
setPreviousTxnLgrSeq(previousTxnLgrSeq);
|
||||
}
|
||||
|
||||
XChainOwnedClaimIDBuilder(SLE const& sle)
|
||||
{
|
||||
if (sle[sfLedgerEntryType] != ltXCHAIN_OWNED_CLAIM_ID)
|
||||
{
|
||||
throw std::runtime_error("Invalid ledger entry type for XChainOwnedClaimID");
|
||||
}
|
||||
object_ = sle;
|
||||
}
|
||||
|
||||
// Ledger entry-specific field setters
|
||||
|
||||
/**
|
||||
* Set sfAccount (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
XChainOwnedClaimIDBuilder&
|
||||
setAccount(std::decay_t<typename SF_ACCOUNT::type::value_type> const& value)
|
||||
{
|
||||
object_[sfAccount] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfXChainBridge (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
XChainOwnedClaimIDBuilder&
|
||||
setXChainBridge(std::decay_t<typename SF_XCHAIN_BRIDGE::type::value_type> const& value)
|
||||
{
|
||||
object_[sfXChainBridge] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfXChainClaimID (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
XChainOwnedClaimIDBuilder&
|
||||
setXChainClaimID(std::decay_t<typename SF_UINT64::type::value_type> const& value)
|
||||
{
|
||||
object_[sfXChainClaimID] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfOtherChainSource (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
XChainOwnedClaimIDBuilder&
|
||||
setOtherChainSource(std::decay_t<typename SF_ACCOUNT::type::value_type> const& value)
|
||||
{
|
||||
object_[sfOtherChainSource] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfXChainClaimAttestations (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
XChainOwnedClaimIDBuilder&
|
||||
setXChainClaimAttestations(STArray const& value)
|
||||
{
|
||||
object_.setFieldArray(sfXChainClaimAttestations, value);
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfSignatureReward (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
XChainOwnedClaimIDBuilder&
|
||||
setSignatureReward(std::decay_t<typename SF_AMOUNT::type::value_type> const& value)
|
||||
{
|
||||
object_[sfSignatureReward] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfOwnerNode (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
XChainOwnedClaimIDBuilder&
|
||||
setOwnerNode(std::decay_t<typename SF_UINT64::type::value_type> const& value)
|
||||
{
|
||||
object_[sfOwnerNode] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfPreviousTxnID (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
XChainOwnedClaimIDBuilder&
|
||||
setPreviousTxnID(std::decay_t<typename SF_UINT256::type::value_type> const& value)
|
||||
{
|
||||
object_[sfPreviousTxnID] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfPreviousTxnLgrSeq (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
XChainOwnedClaimIDBuilder&
|
||||
setPreviousTxnLgrSeq(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfPreviousTxnLgrSeq] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build and return the completed XChainOwnedClaimID wrapper.
|
||||
* @return The constructed ledger entry wrapper.
|
||||
* @throws std::runtime_error if the JSON cannot be parsed into a valid ledger entry.
|
||||
*/
|
||||
XChainOwnedClaimID
|
||||
build(uint256 const& index)
|
||||
{
|
||||
return XChainOwnedClaimID{SLE(object_, index)};
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::ledger_entries
|
||||
@@ -1,240 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STLedgerEntry.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/LedgerEntryBase.h>
|
||||
#include <xrpl/protocol_autogen/LedgerEntryBuilderBase.h>
|
||||
#include <xrpl/json/json_value.h>
|
||||
|
||||
#include <stdexcept>
|
||||
#include <optional>
|
||||
|
||||
namespace xrpl::ledger_entries {
|
||||
|
||||
// Forward declaration
|
||||
class XChainOwnedCreateAccountClaimIDBuilder;
|
||||
|
||||
/**
|
||||
* Ledger Entry: XChainOwnedCreateAccountClaimID
|
||||
* Type: ltXCHAIN_OWNED_CREATE_ACCOUNT_CLAIM_ID (0x0074)
|
||||
* RPC Name: xchain_owned_create_account_claim_id
|
||||
*
|
||||
* Immutable wrapper around SLE providing type-safe field access.
|
||||
* Use XChainOwnedCreateAccountClaimIDBuilder to construct new ledger entries.
|
||||
*/
|
||||
class XChainOwnedCreateAccountClaimID : public LedgerEntryBase
|
||||
{
|
||||
public:
|
||||
static constexpr LedgerEntryType entryType = ltXCHAIN_OWNED_CREATE_ACCOUNT_CLAIM_ID;
|
||||
|
||||
/**
|
||||
* Construct a XChainOwnedCreateAccountClaimID ledger entry wrapper from an existing SLE object.
|
||||
* @throws std::runtime_error if the ledger entry type doesn't match.
|
||||
*/
|
||||
explicit XChainOwnedCreateAccountClaimID(SLE const& sle)
|
||||
: LedgerEntryBase(sle)
|
||||
{
|
||||
// Verify ledger entry type
|
||||
if (sle.getType() != entryType)
|
||||
{
|
||||
throw std::runtime_error("Invalid ledger entry type for XChainOwnedCreateAccountClaimID");
|
||||
}
|
||||
}
|
||||
|
||||
// Ledger entry-specific field getters
|
||||
|
||||
/**
|
||||
* Get sfAccount (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_ACCOUNT::type::value_type
|
||||
getAccount() const
|
||||
{
|
||||
return this->sle_.at(sfAccount);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfXChainBridge (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_XCHAIN_BRIDGE::type::value_type
|
||||
getXChainBridge() const
|
||||
{
|
||||
return this->sle_.at(sfXChainBridge);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfXChainAccountCreateCount (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT64::type::value_type
|
||||
getXChainAccountCreateCount() const
|
||||
{
|
||||
return this->sle_.at(sfXChainAccountCreateCount);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfXChainCreateAccountAttestations (soeREQUIRED)
|
||||
* Note: This is an untyped field (unknown).
|
||||
*/
|
||||
[[nodiscard]]
|
||||
STArray const&
|
||||
getXChainCreateAccountAttestations() const
|
||||
{
|
||||
return this->sle_.getFieldArray(sfXChainCreateAccountAttestations);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfOwnerNode (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT64::type::value_type
|
||||
getOwnerNode() const
|
||||
{
|
||||
return this->sle_.at(sfOwnerNode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfPreviousTxnID (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT256::type::value_type
|
||||
getPreviousTxnID() const
|
||||
{
|
||||
return this->sle_.at(sfPreviousTxnID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfPreviousTxnLgrSeq (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT32::type::value_type
|
||||
getPreviousTxnLgrSeq() const
|
||||
{
|
||||
return this->sle_.at(sfPreviousTxnLgrSeq);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Builder for XChainOwnedCreateAccountClaimID ledger entries.
|
||||
* Provides a fluent interface for constructing ledger entries with method chaining.
|
||||
* Uses Json::Value internally for flexible ledger entry construction.
|
||||
* Inherits common field setters from LedgerEntryBuilderBase.
|
||||
*/
|
||||
class XChainOwnedCreateAccountClaimIDBuilder : public LedgerEntryBuilderBase<XChainOwnedCreateAccountClaimIDBuilder>
|
||||
{
|
||||
public:
|
||||
XChainOwnedCreateAccountClaimIDBuilder(std::decay_t<typename SF_ACCOUNT::type::value_type> const& account,std::decay_t<typename SF_XCHAIN_BRIDGE::type::value_type> const& xChainBridge,std::decay_t<typename SF_UINT64::type::value_type> const& xChainAccountCreateCount,STArray const& xChainCreateAccountAttestations,std::decay_t<typename SF_UINT64::type::value_type> const& ownerNode,std::decay_t<typename SF_UINT256::type::value_type> const& previousTxnID,std::decay_t<typename SF_UINT32::type::value_type> const& previousTxnLgrSeq)
|
||||
: LedgerEntryBuilderBase<XChainOwnedCreateAccountClaimIDBuilder>(ltXCHAIN_OWNED_CREATE_ACCOUNT_CLAIM_ID)
|
||||
{
|
||||
setAccount(account);
|
||||
setXChainBridge(xChainBridge);
|
||||
setXChainAccountCreateCount(xChainAccountCreateCount);
|
||||
setXChainCreateAccountAttestations(xChainCreateAccountAttestations);
|
||||
setOwnerNode(ownerNode);
|
||||
setPreviousTxnID(previousTxnID);
|
||||
setPreviousTxnLgrSeq(previousTxnLgrSeq);
|
||||
}
|
||||
|
||||
XChainOwnedCreateAccountClaimIDBuilder(SLE const& sle)
|
||||
{
|
||||
if (sle[sfLedgerEntryType] != ltXCHAIN_OWNED_CREATE_ACCOUNT_CLAIM_ID)
|
||||
{
|
||||
throw std::runtime_error("Invalid ledger entry type for XChainOwnedCreateAccountClaimID");
|
||||
}
|
||||
object_ = sle;
|
||||
}
|
||||
|
||||
// Ledger entry-specific field setters
|
||||
|
||||
/**
|
||||
* Set sfAccount (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
XChainOwnedCreateAccountClaimIDBuilder&
|
||||
setAccount(std::decay_t<typename SF_ACCOUNT::type::value_type> const& value)
|
||||
{
|
||||
object_[sfAccount] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfXChainBridge (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
XChainOwnedCreateAccountClaimIDBuilder&
|
||||
setXChainBridge(std::decay_t<typename SF_XCHAIN_BRIDGE::type::value_type> const& value)
|
||||
{
|
||||
object_[sfXChainBridge] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfXChainAccountCreateCount (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
XChainOwnedCreateAccountClaimIDBuilder&
|
||||
setXChainAccountCreateCount(std::decay_t<typename SF_UINT64::type::value_type> const& value)
|
||||
{
|
||||
object_[sfXChainAccountCreateCount] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfXChainCreateAccountAttestations (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
XChainOwnedCreateAccountClaimIDBuilder&
|
||||
setXChainCreateAccountAttestations(STArray const& value)
|
||||
{
|
||||
object_.setFieldArray(sfXChainCreateAccountAttestations, value);
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfOwnerNode (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
XChainOwnedCreateAccountClaimIDBuilder&
|
||||
setOwnerNode(std::decay_t<typename SF_UINT64::type::value_type> const& value)
|
||||
{
|
||||
object_[sfOwnerNode] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfPreviousTxnID (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
XChainOwnedCreateAccountClaimIDBuilder&
|
||||
setPreviousTxnID(std::decay_t<typename SF_UINT256::type::value_type> const& value)
|
||||
{
|
||||
object_[sfPreviousTxnID] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfPreviousTxnLgrSeq (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
XChainOwnedCreateAccountClaimIDBuilder&
|
||||
setPreviousTxnLgrSeq(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfPreviousTxnLgrSeq] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build and return the completed XChainOwnedCreateAccountClaimID wrapper.
|
||||
* @return The constructed ledger entry wrapper.
|
||||
* @throws std::runtime_error if the JSON cannot be parsed into a valid ledger entry.
|
||||
*/
|
||||
XChainOwnedCreateAccountClaimID
|
||||
build(uint256 const& index)
|
||||
{
|
||||
return XChainOwnedCreateAccountClaimID{SLE(object_, index)};
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::ledger_entries
|
||||
@@ -1,228 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STTx.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/TransactionBase.h>
|
||||
#include <xrpl/protocol_autogen/TransactionBuilderBase.h>
|
||||
#include <xrpl/json/json_value.h>
|
||||
|
||||
#include <stdexcept>
|
||||
#include <optional>
|
||||
|
||||
namespace xrpl::transactions {
|
||||
|
||||
// Forward declaration
|
||||
class AMMBidBuilder;
|
||||
|
||||
/**
|
||||
* Transaction: AMMBid
|
||||
* Type: ttAMM_BID (39)
|
||||
* Delegable: Delegation::delegable
|
||||
* Amendment: featureAMM
|
||||
* Privileges: noPriv
|
||||
*
|
||||
* Immutable wrapper around STTx providing type-safe field access.
|
||||
* Use AMMBidBuilder to construct new transactions.
|
||||
*/
|
||||
class AMMBid : public TransactionBase
|
||||
{
|
||||
public:
|
||||
static constexpr xrpl::TxType txType = ttAMM_BID;
|
||||
|
||||
/**
|
||||
* Construct a AMMBid transaction wrapper from an existing STTx object.
|
||||
* @throws std::runtime_error if the transaction type doesn't match.
|
||||
*/
|
||||
explicit AMMBid(STTx const& tx)
|
||||
: TransactionBase(tx)
|
||||
{
|
||||
// Verify transaction type
|
||||
if (tx.getTxnType() != txType)
|
||||
{
|
||||
throw std::runtime_error("Invalid transaction type for AMMBid");
|
||||
}
|
||||
}
|
||||
|
||||
// Transaction-specific field getters
|
||||
|
||||
/**
|
||||
* Get sfAsset (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_ISSUE::type::value_type
|
||||
getAsset() const
|
||||
{
|
||||
return this->tx_.at(sfAsset);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfAsset2 (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_ISSUE::type::value_type
|
||||
getAsset2() const
|
||||
{
|
||||
return this->tx_.at(sfAsset2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfBidMin (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_AMOUNT::type::value_type>
|
||||
getBidMin() const
|
||||
{
|
||||
if (hasBidMin())
|
||||
{
|
||||
return this->tx_.at(sfBidMin);
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasBidMin() const
|
||||
{
|
||||
return this->tx_.isFieldPresent(sfBidMin);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfBidMax (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_AMOUNT::type::value_type>
|
||||
getBidMax() const
|
||||
{
|
||||
if (hasBidMax())
|
||||
{
|
||||
return this->tx_.at(sfBidMax);
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasBidMax() const
|
||||
{
|
||||
return this->tx_.isFieldPresent(sfBidMax);
|
||||
}
|
||||
/**
|
||||
* Get sfAuthAccounts (soeOPTIONAL)
|
||||
* Note: This is an untyped field
|
||||
*/
|
||||
[[nodiscard]]
|
||||
std::optional<std::reference_wrapper<STArray const>>
|
||||
getAuthAccounts() const
|
||||
{
|
||||
if (this->tx_.isFieldPresent(sfAuthAccounts))
|
||||
return this->tx_.getFieldArray(sfAuthAccounts);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasAuthAccounts() const
|
||||
{
|
||||
return this->tx_.isFieldPresent(sfAuthAccounts);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Builder for AMMBid transactions.
|
||||
* Provides a fluent interface for constructing transactions with method chaining.
|
||||
* Uses Json::Value internally for flexible transaction construction.
|
||||
* Inherits common field setters from TransactionBuilderBase.
|
||||
*/
|
||||
class AMMBidBuilder : public TransactionBuilderBase<AMMBidBuilder>
|
||||
{
|
||||
public:
|
||||
AMMBidBuilder(SF_ACCOUNT::type::value_type account,
|
||||
std::decay_t<typename SF_ISSUE::type::value_type> const& asset, std::decay_t<typename SF_ISSUE::type::value_type> const& asset2, std::optional<SF_UINT32::type::value_type> sequence = std::nullopt,
|
||||
std::optional<SF_AMOUNT::type::value_type> fee = std::nullopt
|
||||
)
|
||||
: TransactionBuilderBase<AMMBidBuilder>(ttAMM_BID, account, sequence, fee)
|
||||
{
|
||||
setAsset(asset);
|
||||
setAsset2(asset2);
|
||||
}
|
||||
|
||||
AMMBidBuilder(STTx const& tx)
|
||||
{
|
||||
if (tx.getTxnType() != ttAMM_BID)
|
||||
{
|
||||
throw std::runtime_error("Invalid transaction type for AMMBidBuilder");
|
||||
}
|
||||
object_ = tx;
|
||||
}
|
||||
|
||||
// Transaction-specific field setters
|
||||
|
||||
/**
|
||||
* Set sfAsset (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
AMMBidBuilder&
|
||||
setAsset(std::decay_t<typename SF_ISSUE::type::value_type> const& value)
|
||||
{
|
||||
object_[sfAsset] = STIssue(sfAsset, value);
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfAsset2 (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
AMMBidBuilder&
|
||||
setAsset2(std::decay_t<typename SF_ISSUE::type::value_type> const& value)
|
||||
{
|
||||
object_[sfAsset2] = STIssue(sfAsset2, value);
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfBidMin (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
AMMBidBuilder&
|
||||
setBidMin(std::decay_t<typename SF_AMOUNT::type::value_type> const& value)
|
||||
{
|
||||
object_[sfBidMin] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfBidMax (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
AMMBidBuilder&
|
||||
setBidMax(std::decay_t<typename SF_AMOUNT::type::value_type> const& value)
|
||||
{
|
||||
object_[sfBidMax] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfAuthAccounts (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
AMMBidBuilder&
|
||||
setAuthAccounts(STArray const& value)
|
||||
{
|
||||
object_.setFieldArray(sfAuthAccounts, value);
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build and return the completed AMMBid wrapper.
|
||||
* @return The constructed transaction wrapper.
|
||||
* @throws std::runtime_error if the JSON cannot be parsed into a valid transaction.
|
||||
*/
|
||||
AMMBid
|
||||
build()
|
||||
{
|
||||
return AMMBid(STTx(std::move(object_)));
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::transactions
|
||||
@@ -1,188 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STTx.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/TransactionBase.h>
|
||||
#include <xrpl/protocol_autogen/TransactionBuilderBase.h>
|
||||
#include <xrpl/json/json_value.h>
|
||||
|
||||
#include <stdexcept>
|
||||
#include <optional>
|
||||
|
||||
namespace xrpl::transactions {
|
||||
|
||||
// Forward declaration
|
||||
class AMMClawbackBuilder;
|
||||
|
||||
/**
|
||||
* Transaction: AMMClawback
|
||||
* Type: ttAMM_CLAWBACK (31)
|
||||
* Delegable: Delegation::delegable
|
||||
* Amendment: featureAMMClawback
|
||||
* Privileges: mayDeleteAcct | overrideFreeze
|
||||
*
|
||||
* Immutable wrapper around STTx providing type-safe field access.
|
||||
* Use AMMClawbackBuilder to construct new transactions.
|
||||
*/
|
||||
class AMMClawback : public TransactionBase
|
||||
{
|
||||
public:
|
||||
static constexpr xrpl::TxType txType = ttAMM_CLAWBACK;
|
||||
|
||||
/**
|
||||
* Construct a AMMClawback transaction wrapper from an existing STTx object.
|
||||
* @throws std::runtime_error if the transaction type doesn't match.
|
||||
*/
|
||||
explicit AMMClawback(STTx const& tx)
|
||||
: TransactionBase(tx)
|
||||
{
|
||||
// Verify transaction type
|
||||
if (tx.getTxnType() != txType)
|
||||
{
|
||||
throw std::runtime_error("Invalid transaction type for AMMClawback");
|
||||
}
|
||||
}
|
||||
|
||||
// Transaction-specific field getters
|
||||
|
||||
/**
|
||||
* Get sfHolder (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_ACCOUNT::type::value_type
|
||||
getHolder() const
|
||||
{
|
||||
return this->tx_.at(sfHolder);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfAsset (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_ISSUE::type::value_type
|
||||
getAsset() const
|
||||
{
|
||||
return this->tx_.at(sfAsset);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfAsset2 (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_ISSUE::type::value_type
|
||||
getAsset2() const
|
||||
{
|
||||
return this->tx_.at(sfAsset2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfAmount (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_AMOUNT::type::value_type>
|
||||
getAmount() const
|
||||
{
|
||||
if (hasAmount())
|
||||
{
|
||||
return this->tx_.at(sfAmount);
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasAmount() const
|
||||
{
|
||||
return this->tx_.isFieldPresent(sfAmount);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Builder for AMMClawback transactions.
|
||||
* Provides a fluent interface for constructing transactions with method chaining.
|
||||
* Uses Json::Value internally for flexible transaction construction.
|
||||
* Inherits common field setters from TransactionBuilderBase.
|
||||
*/
|
||||
class AMMClawbackBuilder : public TransactionBuilderBase<AMMClawbackBuilder>
|
||||
{
|
||||
public:
|
||||
AMMClawbackBuilder(SF_ACCOUNT::type::value_type account,
|
||||
std::decay_t<typename SF_ACCOUNT::type::value_type> const& holder, std::decay_t<typename SF_ISSUE::type::value_type> const& asset, std::decay_t<typename SF_ISSUE::type::value_type> const& asset2, std::optional<SF_UINT32::type::value_type> sequence = std::nullopt,
|
||||
std::optional<SF_AMOUNT::type::value_type> fee = std::nullopt
|
||||
)
|
||||
: TransactionBuilderBase<AMMClawbackBuilder>(ttAMM_CLAWBACK, account, sequence, fee)
|
||||
{
|
||||
setHolder(holder);
|
||||
setAsset(asset);
|
||||
setAsset2(asset2);
|
||||
}
|
||||
|
||||
AMMClawbackBuilder(STTx const& tx)
|
||||
{
|
||||
if (tx.getTxnType() != ttAMM_CLAWBACK)
|
||||
{
|
||||
throw std::runtime_error("Invalid transaction type for AMMClawbackBuilder");
|
||||
}
|
||||
object_ = tx;
|
||||
}
|
||||
|
||||
// Transaction-specific field setters
|
||||
|
||||
/**
|
||||
* Set sfHolder (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
AMMClawbackBuilder&
|
||||
setHolder(std::decay_t<typename SF_ACCOUNT::type::value_type> const& value)
|
||||
{
|
||||
object_[sfHolder] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfAsset (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
AMMClawbackBuilder&
|
||||
setAsset(std::decay_t<typename SF_ISSUE::type::value_type> const& value)
|
||||
{
|
||||
object_[sfAsset] = STIssue(sfAsset, value);
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfAsset2 (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
AMMClawbackBuilder&
|
||||
setAsset2(std::decay_t<typename SF_ISSUE::type::value_type> const& value)
|
||||
{
|
||||
object_[sfAsset2] = STIssue(sfAsset2, value);
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfAmount (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
AMMClawbackBuilder&
|
||||
setAmount(std::decay_t<typename SF_AMOUNT::type::value_type> const& value)
|
||||
{
|
||||
object_[sfAmount] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build and return the completed AMMClawback wrapper.
|
||||
* @return The constructed transaction wrapper.
|
||||
* @throws std::runtime_error if the JSON cannot be parsed into a valid transaction.
|
||||
*/
|
||||
AMMClawback
|
||||
build()
|
||||
{
|
||||
return AMMClawback(STTx(std::move(object_)));
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::transactions
|
||||
@@ -1,156 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STTx.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/TransactionBase.h>
|
||||
#include <xrpl/protocol_autogen/TransactionBuilderBase.h>
|
||||
#include <xrpl/json/json_value.h>
|
||||
|
||||
#include <stdexcept>
|
||||
#include <optional>
|
||||
|
||||
namespace xrpl::transactions {
|
||||
|
||||
// Forward declaration
|
||||
class AMMCreateBuilder;
|
||||
|
||||
/**
|
||||
* Transaction: AMMCreate
|
||||
* Type: ttAMM_CREATE (35)
|
||||
* Delegable: Delegation::delegable
|
||||
* Amendment: featureAMM
|
||||
* Privileges: createPseudoAcct
|
||||
*
|
||||
* Immutable wrapper around STTx providing type-safe field access.
|
||||
* Use AMMCreateBuilder to construct new transactions.
|
||||
*/
|
||||
class AMMCreate : public TransactionBase
|
||||
{
|
||||
public:
|
||||
static constexpr xrpl::TxType txType = ttAMM_CREATE;
|
||||
|
||||
/**
|
||||
* Construct a AMMCreate transaction wrapper from an existing STTx object.
|
||||
* @throws std::runtime_error if the transaction type doesn't match.
|
||||
*/
|
||||
explicit AMMCreate(STTx const& tx)
|
||||
: TransactionBase(tx)
|
||||
{
|
||||
// Verify transaction type
|
||||
if (tx.getTxnType() != txType)
|
||||
{
|
||||
throw std::runtime_error("Invalid transaction type for AMMCreate");
|
||||
}
|
||||
}
|
||||
|
||||
// Transaction-specific field getters
|
||||
|
||||
/**
|
||||
* Get sfAmount (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_AMOUNT::type::value_type
|
||||
getAmount() const
|
||||
{
|
||||
return this->tx_.at(sfAmount);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfAmount2 (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_AMOUNT::type::value_type
|
||||
getAmount2() const
|
||||
{
|
||||
return this->tx_.at(sfAmount2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfTradingFee (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT16::type::value_type
|
||||
getTradingFee() const
|
||||
{
|
||||
return this->tx_.at(sfTradingFee);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Builder for AMMCreate transactions.
|
||||
* Provides a fluent interface for constructing transactions with method chaining.
|
||||
* Uses Json::Value internally for flexible transaction construction.
|
||||
* Inherits common field setters from TransactionBuilderBase.
|
||||
*/
|
||||
class AMMCreateBuilder : public TransactionBuilderBase<AMMCreateBuilder>
|
||||
{
|
||||
public:
|
||||
AMMCreateBuilder(SF_ACCOUNT::type::value_type account,
|
||||
std::decay_t<typename SF_AMOUNT::type::value_type> const& amount, std::decay_t<typename SF_AMOUNT::type::value_type> const& amount2, std::decay_t<typename SF_UINT16::type::value_type> const& tradingFee, std::optional<SF_UINT32::type::value_type> sequence = std::nullopt,
|
||||
std::optional<SF_AMOUNT::type::value_type> fee = std::nullopt
|
||||
)
|
||||
: TransactionBuilderBase<AMMCreateBuilder>(ttAMM_CREATE, account, sequence, fee)
|
||||
{
|
||||
setAmount(amount);
|
||||
setAmount2(amount2);
|
||||
setTradingFee(tradingFee);
|
||||
}
|
||||
|
||||
AMMCreateBuilder(STTx const& tx)
|
||||
{
|
||||
if (tx.getTxnType() != ttAMM_CREATE)
|
||||
{
|
||||
throw std::runtime_error("Invalid transaction type for AMMCreateBuilder");
|
||||
}
|
||||
object_ = tx;
|
||||
}
|
||||
|
||||
// Transaction-specific field setters
|
||||
|
||||
/**
|
||||
* Set sfAmount (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
AMMCreateBuilder&
|
||||
setAmount(std::decay_t<typename SF_AMOUNT::type::value_type> const& value)
|
||||
{
|
||||
object_[sfAmount] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfAmount2 (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
AMMCreateBuilder&
|
||||
setAmount2(std::decay_t<typename SF_AMOUNT::type::value_type> const& value)
|
||||
{
|
||||
object_[sfAmount2] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfTradingFee (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
AMMCreateBuilder&
|
||||
setTradingFee(std::decay_t<typename SF_UINT16::type::value_type> const& value)
|
||||
{
|
||||
object_[sfTradingFee] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build and return the completed AMMCreate wrapper.
|
||||
* @return The constructed transaction wrapper.
|
||||
* @throws std::runtime_error if the JSON cannot be parsed into a valid transaction.
|
||||
*/
|
||||
AMMCreate
|
||||
build()
|
||||
{
|
||||
return AMMCreate(STTx(std::move(object_)));
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::transactions
|
||||
@@ -1,134 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STTx.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/TransactionBase.h>
|
||||
#include <xrpl/protocol_autogen/TransactionBuilderBase.h>
|
||||
#include <xrpl/json/json_value.h>
|
||||
|
||||
#include <stdexcept>
|
||||
#include <optional>
|
||||
|
||||
namespace xrpl::transactions {
|
||||
|
||||
// Forward declaration
|
||||
class AMMDeleteBuilder;
|
||||
|
||||
/**
|
||||
* Transaction: AMMDelete
|
||||
* Type: ttAMM_DELETE (40)
|
||||
* Delegable: Delegation::delegable
|
||||
* Amendment: featureAMM
|
||||
* Privileges: mustDeleteAcct
|
||||
*
|
||||
* Immutable wrapper around STTx providing type-safe field access.
|
||||
* Use AMMDeleteBuilder to construct new transactions.
|
||||
*/
|
||||
class AMMDelete : public TransactionBase
|
||||
{
|
||||
public:
|
||||
static constexpr xrpl::TxType txType = ttAMM_DELETE;
|
||||
|
||||
/**
|
||||
* Construct a AMMDelete transaction wrapper from an existing STTx object.
|
||||
* @throws std::runtime_error if the transaction type doesn't match.
|
||||
*/
|
||||
explicit AMMDelete(STTx const& tx)
|
||||
: TransactionBase(tx)
|
||||
{
|
||||
// Verify transaction type
|
||||
if (tx.getTxnType() != txType)
|
||||
{
|
||||
throw std::runtime_error("Invalid transaction type for AMMDelete");
|
||||
}
|
||||
}
|
||||
|
||||
// Transaction-specific field getters
|
||||
|
||||
/**
|
||||
* Get sfAsset (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_ISSUE::type::value_type
|
||||
getAsset() const
|
||||
{
|
||||
return this->tx_.at(sfAsset);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfAsset2 (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_ISSUE::type::value_type
|
||||
getAsset2() const
|
||||
{
|
||||
return this->tx_.at(sfAsset2);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Builder for AMMDelete transactions.
|
||||
* Provides a fluent interface for constructing transactions with method chaining.
|
||||
* Uses Json::Value internally for flexible transaction construction.
|
||||
* Inherits common field setters from TransactionBuilderBase.
|
||||
*/
|
||||
class AMMDeleteBuilder : public TransactionBuilderBase<AMMDeleteBuilder>
|
||||
{
|
||||
public:
|
||||
AMMDeleteBuilder(SF_ACCOUNT::type::value_type account,
|
||||
std::decay_t<typename SF_ISSUE::type::value_type> const& asset, std::decay_t<typename SF_ISSUE::type::value_type> const& asset2, std::optional<SF_UINT32::type::value_type> sequence = std::nullopt,
|
||||
std::optional<SF_AMOUNT::type::value_type> fee = std::nullopt
|
||||
)
|
||||
: TransactionBuilderBase<AMMDeleteBuilder>(ttAMM_DELETE, account, sequence, fee)
|
||||
{
|
||||
setAsset(asset);
|
||||
setAsset2(asset2);
|
||||
}
|
||||
|
||||
AMMDeleteBuilder(STTx const& tx)
|
||||
{
|
||||
if (tx.getTxnType() != ttAMM_DELETE)
|
||||
{
|
||||
throw std::runtime_error("Invalid transaction type for AMMDeleteBuilder");
|
||||
}
|
||||
object_ = tx;
|
||||
}
|
||||
|
||||
// Transaction-specific field setters
|
||||
|
||||
/**
|
||||
* Set sfAsset (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
AMMDeleteBuilder&
|
||||
setAsset(std::decay_t<typename SF_ISSUE::type::value_type> const& value)
|
||||
{
|
||||
object_[sfAsset] = STIssue(sfAsset, value);
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfAsset2 (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
AMMDeleteBuilder&
|
||||
setAsset2(std::decay_t<typename SF_ISSUE::type::value_type> const& value)
|
||||
{
|
||||
object_[sfAsset2] = STIssue(sfAsset2, value);
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build and return the completed AMMDelete wrapper.
|
||||
* @return The constructed transaction wrapper.
|
||||
* @throws std::runtime_error if the JSON cannot be parsed into a valid transaction.
|
||||
*/
|
||||
AMMDelete
|
||||
build()
|
||||
{
|
||||
return AMMDelete(STTx(std::move(object_)));
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::transactions
|
||||
@@ -1,294 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STTx.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/TransactionBase.h>
|
||||
#include <xrpl/protocol_autogen/TransactionBuilderBase.h>
|
||||
#include <xrpl/json/json_value.h>
|
||||
|
||||
#include <stdexcept>
|
||||
#include <optional>
|
||||
|
||||
namespace xrpl::transactions {
|
||||
|
||||
// Forward declaration
|
||||
class AMMDepositBuilder;
|
||||
|
||||
/**
|
||||
* Transaction: AMMDeposit
|
||||
* Type: ttAMM_DEPOSIT (36)
|
||||
* Delegable: Delegation::delegable
|
||||
* Amendment: featureAMM
|
||||
* Privileges: noPriv
|
||||
*
|
||||
* Immutable wrapper around STTx providing type-safe field access.
|
||||
* Use AMMDepositBuilder to construct new transactions.
|
||||
*/
|
||||
class AMMDeposit : public TransactionBase
|
||||
{
|
||||
public:
|
||||
static constexpr xrpl::TxType txType = ttAMM_DEPOSIT;
|
||||
|
||||
/**
|
||||
* Construct a AMMDeposit transaction wrapper from an existing STTx object.
|
||||
* @throws std::runtime_error if the transaction type doesn't match.
|
||||
*/
|
||||
explicit AMMDeposit(STTx const& tx)
|
||||
: TransactionBase(tx)
|
||||
{
|
||||
// Verify transaction type
|
||||
if (tx.getTxnType() != txType)
|
||||
{
|
||||
throw std::runtime_error("Invalid transaction type for AMMDeposit");
|
||||
}
|
||||
}
|
||||
|
||||
// Transaction-specific field getters
|
||||
|
||||
/**
|
||||
* Get sfAsset (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_ISSUE::type::value_type
|
||||
getAsset() const
|
||||
{
|
||||
return this->tx_.at(sfAsset);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfAsset2 (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_ISSUE::type::value_type
|
||||
getAsset2() const
|
||||
{
|
||||
return this->tx_.at(sfAsset2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfAmount (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_AMOUNT::type::value_type>
|
||||
getAmount() const
|
||||
{
|
||||
if (hasAmount())
|
||||
{
|
||||
return this->tx_.at(sfAmount);
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasAmount() const
|
||||
{
|
||||
return this->tx_.isFieldPresent(sfAmount);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfAmount2 (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_AMOUNT::type::value_type>
|
||||
getAmount2() const
|
||||
{
|
||||
if (hasAmount2())
|
||||
{
|
||||
return this->tx_.at(sfAmount2);
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasAmount2() const
|
||||
{
|
||||
return this->tx_.isFieldPresent(sfAmount2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfEPrice (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_AMOUNT::type::value_type>
|
||||
getEPrice() const
|
||||
{
|
||||
if (hasEPrice())
|
||||
{
|
||||
return this->tx_.at(sfEPrice);
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasEPrice() const
|
||||
{
|
||||
return this->tx_.isFieldPresent(sfEPrice);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfLPTokenOut (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_AMOUNT::type::value_type>
|
||||
getLPTokenOut() const
|
||||
{
|
||||
if (hasLPTokenOut())
|
||||
{
|
||||
return this->tx_.at(sfLPTokenOut);
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasLPTokenOut() const
|
||||
{
|
||||
return this->tx_.isFieldPresent(sfLPTokenOut);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfTradingFee (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT16::type::value_type>
|
||||
getTradingFee() const
|
||||
{
|
||||
if (hasTradingFee())
|
||||
{
|
||||
return this->tx_.at(sfTradingFee);
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasTradingFee() const
|
||||
{
|
||||
return this->tx_.isFieldPresent(sfTradingFee);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Builder for AMMDeposit transactions.
|
||||
* Provides a fluent interface for constructing transactions with method chaining.
|
||||
* Uses Json::Value internally for flexible transaction construction.
|
||||
* Inherits common field setters from TransactionBuilderBase.
|
||||
*/
|
||||
class AMMDepositBuilder : public TransactionBuilderBase<AMMDepositBuilder>
|
||||
{
|
||||
public:
|
||||
AMMDepositBuilder(SF_ACCOUNT::type::value_type account,
|
||||
std::decay_t<typename SF_ISSUE::type::value_type> const& asset, std::decay_t<typename SF_ISSUE::type::value_type> const& asset2, std::optional<SF_UINT32::type::value_type> sequence = std::nullopt,
|
||||
std::optional<SF_AMOUNT::type::value_type> fee = std::nullopt
|
||||
)
|
||||
: TransactionBuilderBase<AMMDepositBuilder>(ttAMM_DEPOSIT, account, sequence, fee)
|
||||
{
|
||||
setAsset(asset);
|
||||
setAsset2(asset2);
|
||||
}
|
||||
|
||||
AMMDepositBuilder(STTx const& tx)
|
||||
{
|
||||
if (tx.getTxnType() != ttAMM_DEPOSIT)
|
||||
{
|
||||
throw std::runtime_error("Invalid transaction type for AMMDepositBuilder");
|
||||
}
|
||||
object_ = tx;
|
||||
}
|
||||
|
||||
// Transaction-specific field setters
|
||||
|
||||
/**
|
||||
* Set sfAsset (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
AMMDepositBuilder&
|
||||
setAsset(std::decay_t<typename SF_ISSUE::type::value_type> const& value)
|
||||
{
|
||||
object_[sfAsset] = STIssue(sfAsset, value);
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfAsset2 (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
AMMDepositBuilder&
|
||||
setAsset2(std::decay_t<typename SF_ISSUE::type::value_type> const& value)
|
||||
{
|
||||
object_[sfAsset2] = STIssue(sfAsset2, value);
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfAmount (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
AMMDepositBuilder&
|
||||
setAmount(std::decay_t<typename SF_AMOUNT::type::value_type> const& value)
|
||||
{
|
||||
object_[sfAmount] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfAmount2 (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
AMMDepositBuilder&
|
||||
setAmount2(std::decay_t<typename SF_AMOUNT::type::value_type> const& value)
|
||||
{
|
||||
object_[sfAmount2] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfEPrice (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
AMMDepositBuilder&
|
||||
setEPrice(std::decay_t<typename SF_AMOUNT::type::value_type> const& value)
|
||||
{
|
||||
object_[sfEPrice] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfLPTokenOut (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
AMMDepositBuilder&
|
||||
setLPTokenOut(std::decay_t<typename SF_AMOUNT::type::value_type> const& value)
|
||||
{
|
||||
object_[sfLPTokenOut] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfTradingFee (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
AMMDepositBuilder&
|
||||
setTradingFee(std::decay_t<typename SF_UINT16::type::value_type> const& value)
|
||||
{
|
||||
object_[sfTradingFee] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build and return the completed AMMDeposit wrapper.
|
||||
* @return The constructed transaction wrapper.
|
||||
* @throws std::runtime_error if the JSON cannot be parsed into a valid transaction.
|
||||
*/
|
||||
AMMDeposit
|
||||
build()
|
||||
{
|
||||
return AMMDeposit(STTx(std::move(object_)));
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::transactions
|
||||
@@ -1,156 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STTx.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/TransactionBase.h>
|
||||
#include <xrpl/protocol_autogen/TransactionBuilderBase.h>
|
||||
#include <xrpl/json/json_value.h>
|
||||
|
||||
#include <stdexcept>
|
||||
#include <optional>
|
||||
|
||||
namespace xrpl::transactions {
|
||||
|
||||
// Forward declaration
|
||||
class AMMVoteBuilder;
|
||||
|
||||
/**
|
||||
* Transaction: AMMVote
|
||||
* Type: ttAMM_VOTE (38)
|
||||
* Delegable: Delegation::delegable
|
||||
* Amendment: featureAMM
|
||||
* Privileges: noPriv
|
||||
*
|
||||
* Immutable wrapper around STTx providing type-safe field access.
|
||||
* Use AMMVoteBuilder to construct new transactions.
|
||||
*/
|
||||
class AMMVote : public TransactionBase
|
||||
{
|
||||
public:
|
||||
static constexpr xrpl::TxType txType = ttAMM_VOTE;
|
||||
|
||||
/**
|
||||
* Construct a AMMVote transaction wrapper from an existing STTx object.
|
||||
* @throws std::runtime_error if the transaction type doesn't match.
|
||||
*/
|
||||
explicit AMMVote(STTx const& tx)
|
||||
: TransactionBase(tx)
|
||||
{
|
||||
// Verify transaction type
|
||||
if (tx.getTxnType() != txType)
|
||||
{
|
||||
throw std::runtime_error("Invalid transaction type for AMMVote");
|
||||
}
|
||||
}
|
||||
|
||||
// Transaction-specific field getters
|
||||
|
||||
/**
|
||||
* Get sfAsset (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_ISSUE::type::value_type
|
||||
getAsset() const
|
||||
{
|
||||
return this->tx_.at(sfAsset);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfAsset2 (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_ISSUE::type::value_type
|
||||
getAsset2() const
|
||||
{
|
||||
return this->tx_.at(sfAsset2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfTradingFee (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT16::type::value_type
|
||||
getTradingFee() const
|
||||
{
|
||||
return this->tx_.at(sfTradingFee);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Builder for AMMVote transactions.
|
||||
* Provides a fluent interface for constructing transactions with method chaining.
|
||||
* Uses Json::Value internally for flexible transaction construction.
|
||||
* Inherits common field setters from TransactionBuilderBase.
|
||||
*/
|
||||
class AMMVoteBuilder : public TransactionBuilderBase<AMMVoteBuilder>
|
||||
{
|
||||
public:
|
||||
AMMVoteBuilder(SF_ACCOUNT::type::value_type account,
|
||||
std::decay_t<typename SF_ISSUE::type::value_type> const& asset, std::decay_t<typename SF_ISSUE::type::value_type> const& asset2, std::decay_t<typename SF_UINT16::type::value_type> const& tradingFee, std::optional<SF_UINT32::type::value_type> sequence = std::nullopt,
|
||||
std::optional<SF_AMOUNT::type::value_type> fee = std::nullopt
|
||||
)
|
||||
: TransactionBuilderBase<AMMVoteBuilder>(ttAMM_VOTE, account, sequence, fee)
|
||||
{
|
||||
setAsset(asset);
|
||||
setAsset2(asset2);
|
||||
setTradingFee(tradingFee);
|
||||
}
|
||||
|
||||
AMMVoteBuilder(STTx const& tx)
|
||||
{
|
||||
if (tx.getTxnType() != ttAMM_VOTE)
|
||||
{
|
||||
throw std::runtime_error("Invalid transaction type for AMMVoteBuilder");
|
||||
}
|
||||
object_ = tx;
|
||||
}
|
||||
|
||||
// Transaction-specific field setters
|
||||
|
||||
/**
|
||||
* Set sfAsset (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
AMMVoteBuilder&
|
||||
setAsset(std::decay_t<typename SF_ISSUE::type::value_type> const& value)
|
||||
{
|
||||
object_[sfAsset] = STIssue(sfAsset, value);
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfAsset2 (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
AMMVoteBuilder&
|
||||
setAsset2(std::decay_t<typename SF_ISSUE::type::value_type> const& value)
|
||||
{
|
||||
object_[sfAsset2] = STIssue(sfAsset2, value);
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfTradingFee (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
AMMVoteBuilder&
|
||||
setTradingFee(std::decay_t<typename SF_UINT16::type::value_type> const& value)
|
||||
{
|
||||
object_[sfTradingFee] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build and return the completed AMMVote wrapper.
|
||||
* @return The constructed transaction wrapper.
|
||||
* @throws std::runtime_error if the JSON cannot be parsed into a valid transaction.
|
||||
*/
|
||||
AMMVote
|
||||
build()
|
||||
{
|
||||
return AMMVote(STTx(std::move(object_)));
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::transactions
|
||||
@@ -1,262 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STTx.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/TransactionBase.h>
|
||||
#include <xrpl/protocol_autogen/TransactionBuilderBase.h>
|
||||
#include <xrpl/json/json_value.h>
|
||||
|
||||
#include <stdexcept>
|
||||
#include <optional>
|
||||
|
||||
namespace xrpl::transactions {
|
||||
|
||||
// Forward declaration
|
||||
class AMMWithdrawBuilder;
|
||||
|
||||
/**
|
||||
* Transaction: AMMWithdraw
|
||||
* Type: ttAMM_WITHDRAW (37)
|
||||
* Delegable: Delegation::delegable
|
||||
* Amendment: featureAMM
|
||||
* Privileges: mayDeleteAcct
|
||||
*
|
||||
* Immutable wrapper around STTx providing type-safe field access.
|
||||
* Use AMMWithdrawBuilder to construct new transactions.
|
||||
*/
|
||||
class AMMWithdraw : public TransactionBase
|
||||
{
|
||||
public:
|
||||
static constexpr xrpl::TxType txType = ttAMM_WITHDRAW;
|
||||
|
||||
/**
|
||||
* Construct a AMMWithdraw transaction wrapper from an existing STTx object.
|
||||
* @throws std::runtime_error if the transaction type doesn't match.
|
||||
*/
|
||||
explicit AMMWithdraw(STTx const& tx)
|
||||
: TransactionBase(tx)
|
||||
{
|
||||
// Verify transaction type
|
||||
if (tx.getTxnType() != txType)
|
||||
{
|
||||
throw std::runtime_error("Invalid transaction type for AMMWithdraw");
|
||||
}
|
||||
}
|
||||
|
||||
// Transaction-specific field getters
|
||||
|
||||
/**
|
||||
* Get sfAsset (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_ISSUE::type::value_type
|
||||
getAsset() const
|
||||
{
|
||||
return this->tx_.at(sfAsset);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfAsset2 (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_ISSUE::type::value_type
|
||||
getAsset2() const
|
||||
{
|
||||
return this->tx_.at(sfAsset2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfAmount (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_AMOUNT::type::value_type>
|
||||
getAmount() const
|
||||
{
|
||||
if (hasAmount())
|
||||
{
|
||||
return this->tx_.at(sfAmount);
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasAmount() const
|
||||
{
|
||||
return this->tx_.isFieldPresent(sfAmount);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfAmount2 (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_AMOUNT::type::value_type>
|
||||
getAmount2() const
|
||||
{
|
||||
if (hasAmount2())
|
||||
{
|
||||
return this->tx_.at(sfAmount2);
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasAmount2() const
|
||||
{
|
||||
return this->tx_.isFieldPresent(sfAmount2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfEPrice (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_AMOUNT::type::value_type>
|
||||
getEPrice() const
|
||||
{
|
||||
if (hasEPrice())
|
||||
{
|
||||
return this->tx_.at(sfEPrice);
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasEPrice() const
|
||||
{
|
||||
return this->tx_.isFieldPresent(sfEPrice);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfLPTokenIn (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_AMOUNT::type::value_type>
|
||||
getLPTokenIn() const
|
||||
{
|
||||
if (hasLPTokenIn())
|
||||
{
|
||||
return this->tx_.at(sfLPTokenIn);
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasLPTokenIn() const
|
||||
{
|
||||
return this->tx_.isFieldPresent(sfLPTokenIn);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Builder for AMMWithdraw transactions.
|
||||
* Provides a fluent interface for constructing transactions with method chaining.
|
||||
* Uses Json::Value internally for flexible transaction construction.
|
||||
* Inherits common field setters from TransactionBuilderBase.
|
||||
*/
|
||||
class AMMWithdrawBuilder : public TransactionBuilderBase<AMMWithdrawBuilder>
|
||||
{
|
||||
public:
|
||||
AMMWithdrawBuilder(SF_ACCOUNT::type::value_type account,
|
||||
std::decay_t<typename SF_ISSUE::type::value_type> const& asset, std::decay_t<typename SF_ISSUE::type::value_type> const& asset2, std::optional<SF_UINT32::type::value_type> sequence = std::nullopt,
|
||||
std::optional<SF_AMOUNT::type::value_type> fee = std::nullopt
|
||||
)
|
||||
: TransactionBuilderBase<AMMWithdrawBuilder>(ttAMM_WITHDRAW, account, sequence, fee)
|
||||
{
|
||||
setAsset(asset);
|
||||
setAsset2(asset2);
|
||||
}
|
||||
|
||||
AMMWithdrawBuilder(STTx const& tx)
|
||||
{
|
||||
if (tx.getTxnType() != ttAMM_WITHDRAW)
|
||||
{
|
||||
throw std::runtime_error("Invalid transaction type for AMMWithdrawBuilder");
|
||||
}
|
||||
object_ = tx;
|
||||
}
|
||||
|
||||
// Transaction-specific field setters
|
||||
|
||||
/**
|
||||
* Set sfAsset (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
AMMWithdrawBuilder&
|
||||
setAsset(std::decay_t<typename SF_ISSUE::type::value_type> const& value)
|
||||
{
|
||||
object_[sfAsset] = STIssue(sfAsset, value);
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfAsset2 (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
AMMWithdrawBuilder&
|
||||
setAsset2(std::decay_t<typename SF_ISSUE::type::value_type> const& value)
|
||||
{
|
||||
object_[sfAsset2] = STIssue(sfAsset2, value);
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfAmount (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
AMMWithdrawBuilder&
|
||||
setAmount(std::decay_t<typename SF_AMOUNT::type::value_type> const& value)
|
||||
{
|
||||
object_[sfAmount] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfAmount2 (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
AMMWithdrawBuilder&
|
||||
setAmount2(std::decay_t<typename SF_AMOUNT::type::value_type> const& value)
|
||||
{
|
||||
object_[sfAmount2] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfEPrice (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
AMMWithdrawBuilder&
|
||||
setEPrice(std::decay_t<typename SF_AMOUNT::type::value_type> const& value)
|
||||
{
|
||||
object_[sfEPrice] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfLPTokenIn (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
AMMWithdrawBuilder&
|
||||
setLPTokenIn(std::decay_t<typename SF_AMOUNT::type::value_type> const& value)
|
||||
{
|
||||
object_[sfLPTokenIn] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build and return the completed AMMWithdraw wrapper.
|
||||
* @return The constructed transaction wrapper.
|
||||
* @throws std::runtime_error if the JSON cannot be parsed into a valid transaction.
|
||||
*/
|
||||
AMMWithdraw
|
||||
build()
|
||||
{
|
||||
return AMMWithdraw(STTx(std::move(object_)));
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::transactions
|
||||
@@ -1,176 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STTx.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/TransactionBase.h>
|
||||
#include <xrpl/protocol_autogen/TransactionBuilderBase.h>
|
||||
#include <xrpl/json/json_value.h>
|
||||
|
||||
#include <stdexcept>
|
||||
#include <optional>
|
||||
|
||||
namespace xrpl::transactions {
|
||||
|
||||
// Forward declaration
|
||||
class AccountDeleteBuilder;
|
||||
|
||||
/**
|
||||
* Transaction: AccountDelete
|
||||
* Type: ttACCOUNT_DELETE (21)
|
||||
* Delegable: Delegation::notDelegable
|
||||
* Amendment: uint256{}
|
||||
* Privileges: mustDeleteAcct
|
||||
*
|
||||
* Immutable wrapper around STTx providing type-safe field access.
|
||||
* Use AccountDeleteBuilder to construct new transactions.
|
||||
*/
|
||||
class AccountDelete : public TransactionBase
|
||||
{
|
||||
public:
|
||||
static constexpr xrpl::TxType txType = ttACCOUNT_DELETE;
|
||||
|
||||
/**
|
||||
* Construct a AccountDelete transaction wrapper from an existing STTx object.
|
||||
* @throws std::runtime_error if the transaction type doesn't match.
|
||||
*/
|
||||
explicit AccountDelete(STTx const& tx)
|
||||
: TransactionBase(tx)
|
||||
{
|
||||
// Verify transaction type
|
||||
if (tx.getTxnType() != txType)
|
||||
{
|
||||
throw std::runtime_error("Invalid transaction type for AccountDelete");
|
||||
}
|
||||
}
|
||||
|
||||
// Transaction-specific field getters
|
||||
|
||||
/**
|
||||
* Get sfDestination (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_ACCOUNT::type::value_type
|
||||
getDestination() const
|
||||
{
|
||||
return this->tx_.at(sfDestination);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfDestinationTag (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT32::type::value_type>
|
||||
getDestinationTag() const
|
||||
{
|
||||
if (hasDestinationTag())
|
||||
{
|
||||
return this->tx_.at(sfDestinationTag);
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasDestinationTag() const
|
||||
{
|
||||
return this->tx_.isFieldPresent(sfDestinationTag);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfCredentialIDs (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_VECTOR256::type::value_type>
|
||||
getCredentialIDs() const
|
||||
{
|
||||
if (hasCredentialIDs())
|
||||
{
|
||||
return this->tx_.at(sfCredentialIDs);
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasCredentialIDs() const
|
||||
{
|
||||
return this->tx_.isFieldPresent(sfCredentialIDs);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Builder for AccountDelete transactions.
|
||||
* Provides a fluent interface for constructing transactions with method chaining.
|
||||
* Uses Json::Value internally for flexible transaction construction.
|
||||
* Inherits common field setters from TransactionBuilderBase.
|
||||
*/
|
||||
class AccountDeleteBuilder : public TransactionBuilderBase<AccountDeleteBuilder>
|
||||
{
|
||||
public:
|
||||
AccountDeleteBuilder(SF_ACCOUNT::type::value_type account,
|
||||
std::decay_t<typename SF_ACCOUNT::type::value_type> const& destination, std::optional<SF_UINT32::type::value_type> sequence = std::nullopt,
|
||||
std::optional<SF_AMOUNT::type::value_type> fee = std::nullopt
|
||||
)
|
||||
: TransactionBuilderBase<AccountDeleteBuilder>(ttACCOUNT_DELETE, account, sequence, fee)
|
||||
{
|
||||
setDestination(destination);
|
||||
}
|
||||
|
||||
AccountDeleteBuilder(STTx const& tx)
|
||||
{
|
||||
if (tx.getTxnType() != ttACCOUNT_DELETE)
|
||||
{
|
||||
throw std::runtime_error("Invalid transaction type for AccountDeleteBuilder");
|
||||
}
|
||||
object_ = tx;
|
||||
}
|
||||
|
||||
// Transaction-specific field setters
|
||||
|
||||
/**
|
||||
* Set sfDestination (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
AccountDeleteBuilder&
|
||||
setDestination(std::decay_t<typename SF_ACCOUNT::type::value_type> const& value)
|
||||
{
|
||||
object_[sfDestination] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfDestinationTag (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
AccountDeleteBuilder&
|
||||
setDestinationTag(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfDestinationTag] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfCredentialIDs (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
AccountDeleteBuilder&
|
||||
setCredentialIDs(std::decay_t<typename SF_VECTOR256::type::value_type> const& value)
|
||||
{
|
||||
object_[sfCredentialIDs] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build and return the completed AccountDelete wrapper.
|
||||
* @return The constructed transaction wrapper.
|
||||
* @throws std::runtime_error if the JSON cannot be parsed into a valid transaction.
|
||||
*/
|
||||
AccountDelete
|
||||
build()
|
||||
{
|
||||
return AccountDelete(STTx(std::move(object_)));
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::transactions
|
||||
@@ -1,410 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STTx.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/TransactionBase.h>
|
||||
#include <xrpl/protocol_autogen/TransactionBuilderBase.h>
|
||||
#include <xrpl/json/json_value.h>
|
||||
|
||||
#include <stdexcept>
|
||||
#include <optional>
|
||||
|
||||
namespace xrpl::transactions {
|
||||
|
||||
// Forward declaration
|
||||
class AccountSetBuilder;
|
||||
|
||||
/**
|
||||
* Transaction: AccountSet
|
||||
* Type: ttACCOUNT_SET (3)
|
||||
* Delegable: Delegation::notDelegable
|
||||
* Amendment: uint256{}
|
||||
* Privileges: noPriv
|
||||
*
|
||||
* Immutable wrapper around STTx providing type-safe field access.
|
||||
* Use AccountSetBuilder to construct new transactions.
|
||||
*/
|
||||
class AccountSet : public TransactionBase
|
||||
{
|
||||
public:
|
||||
static constexpr xrpl::TxType txType = ttACCOUNT_SET;
|
||||
|
||||
/**
|
||||
* Construct a AccountSet transaction wrapper from an existing STTx object.
|
||||
* @throws std::runtime_error if the transaction type doesn't match.
|
||||
*/
|
||||
explicit AccountSet(STTx const& tx)
|
||||
: TransactionBase(tx)
|
||||
{
|
||||
// Verify transaction type
|
||||
if (tx.getTxnType() != txType)
|
||||
{
|
||||
throw std::runtime_error("Invalid transaction type for AccountSet");
|
||||
}
|
||||
}
|
||||
|
||||
// Transaction-specific field getters
|
||||
|
||||
/**
|
||||
* Get sfEmailHash (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT128::type::value_type>
|
||||
getEmailHash() const
|
||||
{
|
||||
if (hasEmailHash())
|
||||
{
|
||||
return this->tx_.at(sfEmailHash);
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasEmailHash() const
|
||||
{
|
||||
return this->tx_.isFieldPresent(sfEmailHash);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfWalletLocator (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT256::type::value_type>
|
||||
getWalletLocator() const
|
||||
{
|
||||
if (hasWalletLocator())
|
||||
{
|
||||
return this->tx_.at(sfWalletLocator);
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasWalletLocator() const
|
||||
{
|
||||
return this->tx_.isFieldPresent(sfWalletLocator);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfWalletSize (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT32::type::value_type>
|
||||
getWalletSize() const
|
||||
{
|
||||
if (hasWalletSize())
|
||||
{
|
||||
return this->tx_.at(sfWalletSize);
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasWalletSize() const
|
||||
{
|
||||
return this->tx_.isFieldPresent(sfWalletSize);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfMessageKey (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_VL::type::value_type>
|
||||
getMessageKey() const
|
||||
{
|
||||
if (hasMessageKey())
|
||||
{
|
||||
return this->tx_.at(sfMessageKey);
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasMessageKey() const
|
||||
{
|
||||
return this->tx_.isFieldPresent(sfMessageKey);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfDomain (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_VL::type::value_type>
|
||||
getDomain() const
|
||||
{
|
||||
if (hasDomain())
|
||||
{
|
||||
return this->tx_.at(sfDomain);
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasDomain() const
|
||||
{
|
||||
return this->tx_.isFieldPresent(sfDomain);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfTransferRate (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT32::type::value_type>
|
||||
getTransferRate() const
|
||||
{
|
||||
if (hasTransferRate())
|
||||
{
|
||||
return this->tx_.at(sfTransferRate);
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasTransferRate() const
|
||||
{
|
||||
return this->tx_.isFieldPresent(sfTransferRate);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfSetFlag (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT32::type::value_type>
|
||||
getSetFlag() const
|
||||
{
|
||||
if (hasSetFlag())
|
||||
{
|
||||
return this->tx_.at(sfSetFlag);
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasSetFlag() const
|
||||
{
|
||||
return this->tx_.isFieldPresent(sfSetFlag);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfClearFlag (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT32::type::value_type>
|
||||
getClearFlag() const
|
||||
{
|
||||
if (hasClearFlag())
|
||||
{
|
||||
return this->tx_.at(sfClearFlag);
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasClearFlag() const
|
||||
{
|
||||
return this->tx_.isFieldPresent(sfClearFlag);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfTickSize (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT8::type::value_type>
|
||||
getTickSize() const
|
||||
{
|
||||
if (hasTickSize())
|
||||
{
|
||||
return this->tx_.at(sfTickSize);
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasTickSize() const
|
||||
{
|
||||
return this->tx_.isFieldPresent(sfTickSize);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfNFTokenMinter (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_ACCOUNT::type::value_type>
|
||||
getNFTokenMinter() const
|
||||
{
|
||||
if (hasNFTokenMinter())
|
||||
{
|
||||
return this->tx_.at(sfNFTokenMinter);
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasNFTokenMinter() const
|
||||
{
|
||||
return this->tx_.isFieldPresent(sfNFTokenMinter);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Builder for AccountSet transactions.
|
||||
* Provides a fluent interface for constructing transactions with method chaining.
|
||||
* Uses Json::Value internally for flexible transaction construction.
|
||||
* Inherits common field setters from TransactionBuilderBase.
|
||||
*/
|
||||
class AccountSetBuilder : public TransactionBuilderBase<AccountSetBuilder>
|
||||
{
|
||||
public:
|
||||
AccountSetBuilder(SF_ACCOUNT::type::value_type account,
|
||||
std::optional<SF_UINT32::type::value_type> sequence = std::nullopt,
|
||||
std::optional<SF_AMOUNT::type::value_type> fee = std::nullopt
|
||||
)
|
||||
: TransactionBuilderBase<AccountSetBuilder>(ttACCOUNT_SET, account, sequence, fee)
|
||||
{
|
||||
}
|
||||
|
||||
AccountSetBuilder(STTx const& tx)
|
||||
{
|
||||
if (tx.getTxnType() != ttACCOUNT_SET)
|
||||
{
|
||||
throw std::runtime_error("Invalid transaction type for AccountSetBuilder");
|
||||
}
|
||||
object_ = tx;
|
||||
}
|
||||
|
||||
// Transaction-specific field setters
|
||||
|
||||
/**
|
||||
* Set sfEmailHash (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
AccountSetBuilder&
|
||||
setEmailHash(std::decay_t<typename SF_UINT128::type::value_type> const& value)
|
||||
{
|
||||
object_[sfEmailHash] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfWalletLocator (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
AccountSetBuilder&
|
||||
setWalletLocator(std::decay_t<typename SF_UINT256::type::value_type> const& value)
|
||||
{
|
||||
object_[sfWalletLocator] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfWalletSize (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
AccountSetBuilder&
|
||||
setWalletSize(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfWalletSize] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfMessageKey (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
AccountSetBuilder&
|
||||
setMessageKey(std::decay_t<typename SF_VL::type::value_type> const& value)
|
||||
{
|
||||
object_[sfMessageKey] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfDomain (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
AccountSetBuilder&
|
||||
setDomain(std::decay_t<typename SF_VL::type::value_type> const& value)
|
||||
{
|
||||
object_[sfDomain] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfTransferRate (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
AccountSetBuilder&
|
||||
setTransferRate(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfTransferRate] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfSetFlag (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
AccountSetBuilder&
|
||||
setSetFlag(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfSetFlag] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfClearFlag (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
AccountSetBuilder&
|
||||
setClearFlag(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfClearFlag] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfTickSize (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
AccountSetBuilder&
|
||||
setTickSize(std::decay_t<typename SF_UINT8::type::value_type> const& value)
|
||||
{
|
||||
object_[sfTickSize] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfNFTokenMinter (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
AccountSetBuilder&
|
||||
setNFTokenMinter(std::decay_t<typename SF_ACCOUNT::type::value_type> const& value)
|
||||
{
|
||||
object_[sfNFTokenMinter] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build and return the completed AccountSet wrapper.
|
||||
* @return The constructed transaction wrapper.
|
||||
* @throws std::runtime_error if the JSON cannot be parsed into a valid transaction.
|
||||
*/
|
||||
AccountSet
|
||||
build()
|
||||
{
|
||||
return AccountSet(STTx(std::move(object_)));
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::transactions
|
||||
@@ -1,142 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STTx.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/TransactionBase.h>
|
||||
#include <xrpl/protocol_autogen/TransactionBuilderBase.h>
|
||||
#include <xrpl/json/json_value.h>
|
||||
|
||||
#include <stdexcept>
|
||||
#include <optional>
|
||||
|
||||
namespace xrpl::transactions {
|
||||
|
||||
// Forward declaration
|
||||
class BatchBuilder;
|
||||
|
||||
/**
|
||||
* Transaction: Batch
|
||||
* Type: ttBATCH (71)
|
||||
* Delegable: Delegation::notDelegable
|
||||
* Amendment: featureBatch
|
||||
* Privileges: noPriv
|
||||
*
|
||||
* Immutable wrapper around STTx providing type-safe field access.
|
||||
* Use BatchBuilder to construct new transactions.
|
||||
*/
|
||||
class Batch : public TransactionBase
|
||||
{
|
||||
public:
|
||||
static constexpr xrpl::TxType txType = ttBATCH;
|
||||
|
||||
/**
|
||||
* Construct a Batch transaction wrapper from an existing STTx object.
|
||||
* @throws std::runtime_error if the transaction type doesn't match.
|
||||
*/
|
||||
explicit Batch(STTx const& tx)
|
||||
: TransactionBase(tx)
|
||||
{
|
||||
// Verify transaction type
|
||||
if (tx.getTxnType() != txType)
|
||||
{
|
||||
throw std::runtime_error("Invalid transaction type for Batch");
|
||||
}
|
||||
}
|
||||
|
||||
// Transaction-specific field getters
|
||||
/**
|
||||
* Get sfRawTransactions (soeREQUIRED)
|
||||
* Note: This is an untyped field
|
||||
*/
|
||||
[[nodiscard]]
|
||||
STArray const&
|
||||
getRawTransactions() const
|
||||
{
|
||||
return this->tx_.getFieldArray(sfRawTransactions);
|
||||
}
|
||||
/**
|
||||
* Get sfBatchSigners (soeOPTIONAL)
|
||||
* Note: This is an untyped field
|
||||
*/
|
||||
[[nodiscard]]
|
||||
std::optional<std::reference_wrapper<STArray const>>
|
||||
getBatchSigners() const
|
||||
{
|
||||
if (this->tx_.isFieldPresent(sfBatchSigners))
|
||||
return this->tx_.getFieldArray(sfBatchSigners);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasBatchSigners() const
|
||||
{
|
||||
return this->tx_.isFieldPresent(sfBatchSigners);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Builder for Batch transactions.
|
||||
* Provides a fluent interface for constructing transactions with method chaining.
|
||||
* Uses Json::Value internally for flexible transaction construction.
|
||||
* Inherits common field setters from TransactionBuilderBase.
|
||||
*/
|
||||
class BatchBuilder : public TransactionBuilderBase<BatchBuilder>
|
||||
{
|
||||
public:
|
||||
BatchBuilder(SF_ACCOUNT::type::value_type account,
|
||||
STArray const& rawTransactions, std::optional<SF_UINT32::type::value_type> sequence = std::nullopt,
|
||||
std::optional<SF_AMOUNT::type::value_type> fee = std::nullopt
|
||||
)
|
||||
: TransactionBuilderBase<BatchBuilder>(ttBATCH, account, sequence, fee)
|
||||
{
|
||||
setRawTransactions(rawTransactions);
|
||||
}
|
||||
|
||||
BatchBuilder(STTx const& tx)
|
||||
{
|
||||
if (tx.getTxnType() != ttBATCH)
|
||||
{
|
||||
throw std::runtime_error("Invalid transaction type for BatchBuilder");
|
||||
}
|
||||
object_ = tx;
|
||||
}
|
||||
|
||||
// Transaction-specific field setters
|
||||
|
||||
/**
|
||||
* Set sfRawTransactions (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
BatchBuilder&
|
||||
setRawTransactions(STArray const& value)
|
||||
{
|
||||
object_.setFieldArray(sfRawTransactions, value);
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfBatchSigners (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
BatchBuilder&
|
||||
setBatchSigners(STArray const& value)
|
||||
{
|
||||
object_.setFieldArray(sfBatchSigners, value);
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build and return the completed Batch wrapper.
|
||||
* @return The constructed transaction wrapper.
|
||||
* @throws std::runtime_error if the JSON cannot be parsed into a valid transaction.
|
||||
*/
|
||||
Batch
|
||||
build()
|
||||
{
|
||||
return Batch(STTx(std::move(object_)));
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::transactions
|
||||
@@ -1,112 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STTx.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/TransactionBase.h>
|
||||
#include <xrpl/protocol_autogen/TransactionBuilderBase.h>
|
||||
#include <xrpl/json/json_value.h>
|
||||
|
||||
#include <stdexcept>
|
||||
#include <optional>
|
||||
|
||||
namespace xrpl::transactions {
|
||||
|
||||
// Forward declaration
|
||||
class CheckCancelBuilder;
|
||||
|
||||
/**
|
||||
* Transaction: CheckCancel
|
||||
* Type: ttCHECK_CANCEL (18)
|
||||
* Delegable: Delegation::delegable
|
||||
* Amendment: uint256{}
|
||||
* Privileges: noPriv
|
||||
*
|
||||
* Immutable wrapper around STTx providing type-safe field access.
|
||||
* Use CheckCancelBuilder to construct new transactions.
|
||||
*/
|
||||
class CheckCancel : public TransactionBase
|
||||
{
|
||||
public:
|
||||
static constexpr xrpl::TxType txType = ttCHECK_CANCEL;
|
||||
|
||||
/**
|
||||
* Construct a CheckCancel transaction wrapper from an existing STTx object.
|
||||
* @throws std::runtime_error if the transaction type doesn't match.
|
||||
*/
|
||||
explicit CheckCancel(STTx const& tx)
|
||||
: TransactionBase(tx)
|
||||
{
|
||||
// Verify transaction type
|
||||
if (tx.getTxnType() != txType)
|
||||
{
|
||||
throw std::runtime_error("Invalid transaction type for CheckCancel");
|
||||
}
|
||||
}
|
||||
|
||||
// Transaction-specific field getters
|
||||
|
||||
/**
|
||||
* Get sfCheckID (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT256::type::value_type
|
||||
getCheckID() const
|
||||
{
|
||||
return this->tx_.at(sfCheckID);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Builder for CheckCancel transactions.
|
||||
* Provides a fluent interface for constructing transactions with method chaining.
|
||||
* Uses Json::Value internally for flexible transaction construction.
|
||||
* Inherits common field setters from TransactionBuilderBase.
|
||||
*/
|
||||
class CheckCancelBuilder : public TransactionBuilderBase<CheckCancelBuilder>
|
||||
{
|
||||
public:
|
||||
CheckCancelBuilder(SF_ACCOUNT::type::value_type account,
|
||||
std::decay_t<typename SF_UINT256::type::value_type> const& checkID, std::optional<SF_UINT32::type::value_type> sequence = std::nullopt,
|
||||
std::optional<SF_AMOUNT::type::value_type> fee = std::nullopt
|
||||
)
|
||||
: TransactionBuilderBase<CheckCancelBuilder>(ttCHECK_CANCEL, account, sequence, fee)
|
||||
{
|
||||
setCheckID(checkID);
|
||||
}
|
||||
|
||||
CheckCancelBuilder(STTx const& tx)
|
||||
{
|
||||
if (tx.getTxnType() != ttCHECK_CANCEL)
|
||||
{
|
||||
throw std::runtime_error("Invalid transaction type for CheckCancelBuilder");
|
||||
}
|
||||
object_ = tx;
|
||||
}
|
||||
|
||||
// Transaction-specific field setters
|
||||
|
||||
/**
|
||||
* Set sfCheckID (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
CheckCancelBuilder&
|
||||
setCheckID(std::decay_t<typename SF_UINT256::type::value_type> const& value)
|
||||
{
|
||||
object_[sfCheckID] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build and return the completed CheckCancel wrapper.
|
||||
* @return The constructed transaction wrapper.
|
||||
* @throws std::runtime_error if the JSON cannot be parsed into a valid transaction.
|
||||
*/
|
||||
CheckCancel
|
||||
build()
|
||||
{
|
||||
return CheckCancel(STTx(std::move(object_)));
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::transactions
|
||||
@@ -1,176 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STTx.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/TransactionBase.h>
|
||||
#include <xrpl/protocol_autogen/TransactionBuilderBase.h>
|
||||
#include <xrpl/json/json_value.h>
|
||||
|
||||
#include <stdexcept>
|
||||
#include <optional>
|
||||
|
||||
namespace xrpl::transactions {
|
||||
|
||||
// Forward declaration
|
||||
class CheckCashBuilder;
|
||||
|
||||
/**
|
||||
* Transaction: CheckCash
|
||||
* Type: ttCHECK_CASH (17)
|
||||
* Delegable: Delegation::delegable
|
||||
* Amendment: uint256{}
|
||||
* Privileges: noPriv
|
||||
*
|
||||
* Immutable wrapper around STTx providing type-safe field access.
|
||||
* Use CheckCashBuilder to construct new transactions.
|
||||
*/
|
||||
class CheckCash : public TransactionBase
|
||||
{
|
||||
public:
|
||||
static constexpr xrpl::TxType txType = ttCHECK_CASH;
|
||||
|
||||
/**
|
||||
* Construct a CheckCash transaction wrapper from an existing STTx object.
|
||||
* @throws std::runtime_error if the transaction type doesn't match.
|
||||
*/
|
||||
explicit CheckCash(STTx const& tx)
|
||||
: TransactionBase(tx)
|
||||
{
|
||||
// Verify transaction type
|
||||
if (tx.getTxnType() != txType)
|
||||
{
|
||||
throw std::runtime_error("Invalid transaction type for CheckCash");
|
||||
}
|
||||
}
|
||||
|
||||
// Transaction-specific field getters
|
||||
|
||||
/**
|
||||
* Get sfCheckID (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT256::type::value_type
|
||||
getCheckID() const
|
||||
{
|
||||
return this->tx_.at(sfCheckID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfAmount (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_AMOUNT::type::value_type>
|
||||
getAmount() const
|
||||
{
|
||||
if (hasAmount())
|
||||
{
|
||||
return this->tx_.at(sfAmount);
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasAmount() const
|
||||
{
|
||||
return this->tx_.isFieldPresent(sfAmount);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfDeliverMin (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_AMOUNT::type::value_type>
|
||||
getDeliverMin() const
|
||||
{
|
||||
if (hasDeliverMin())
|
||||
{
|
||||
return this->tx_.at(sfDeliverMin);
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasDeliverMin() const
|
||||
{
|
||||
return this->tx_.isFieldPresent(sfDeliverMin);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Builder for CheckCash transactions.
|
||||
* Provides a fluent interface for constructing transactions with method chaining.
|
||||
* Uses Json::Value internally for flexible transaction construction.
|
||||
* Inherits common field setters from TransactionBuilderBase.
|
||||
*/
|
||||
class CheckCashBuilder : public TransactionBuilderBase<CheckCashBuilder>
|
||||
{
|
||||
public:
|
||||
CheckCashBuilder(SF_ACCOUNT::type::value_type account,
|
||||
std::decay_t<typename SF_UINT256::type::value_type> const& checkID, std::optional<SF_UINT32::type::value_type> sequence = std::nullopt,
|
||||
std::optional<SF_AMOUNT::type::value_type> fee = std::nullopt
|
||||
)
|
||||
: TransactionBuilderBase<CheckCashBuilder>(ttCHECK_CASH, account, sequence, fee)
|
||||
{
|
||||
setCheckID(checkID);
|
||||
}
|
||||
|
||||
CheckCashBuilder(STTx const& tx)
|
||||
{
|
||||
if (tx.getTxnType() != ttCHECK_CASH)
|
||||
{
|
||||
throw std::runtime_error("Invalid transaction type for CheckCashBuilder");
|
||||
}
|
||||
object_ = tx;
|
||||
}
|
||||
|
||||
// Transaction-specific field setters
|
||||
|
||||
/**
|
||||
* Set sfCheckID (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
CheckCashBuilder&
|
||||
setCheckID(std::decay_t<typename SF_UINT256::type::value_type> const& value)
|
||||
{
|
||||
object_[sfCheckID] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfAmount (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
CheckCashBuilder&
|
||||
setAmount(std::decay_t<typename SF_AMOUNT::type::value_type> const& value)
|
||||
{
|
||||
object_[sfAmount] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfDeliverMin (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
CheckCashBuilder&
|
||||
setDeliverMin(std::decay_t<typename SF_AMOUNT::type::value_type> const& value)
|
||||
{
|
||||
object_[sfDeliverMin] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build and return the completed CheckCash wrapper.
|
||||
* @return The constructed transaction wrapper.
|
||||
* @throws std::runtime_error if the JSON cannot be parsed into a valid transaction.
|
||||
*/
|
||||
CheckCash
|
||||
build()
|
||||
{
|
||||
return CheckCash(STTx(std::move(object_)));
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::transactions
|
||||
@@ -1,230 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STTx.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/TransactionBase.h>
|
||||
#include <xrpl/protocol_autogen/TransactionBuilderBase.h>
|
||||
#include <xrpl/json/json_value.h>
|
||||
|
||||
#include <stdexcept>
|
||||
#include <optional>
|
||||
|
||||
namespace xrpl::transactions {
|
||||
|
||||
// Forward declaration
|
||||
class CheckCreateBuilder;
|
||||
|
||||
/**
|
||||
* Transaction: CheckCreate
|
||||
* Type: ttCHECK_CREATE (16)
|
||||
* Delegable: Delegation::delegable
|
||||
* Amendment: uint256{}
|
||||
* Privileges: noPriv
|
||||
*
|
||||
* Immutable wrapper around STTx providing type-safe field access.
|
||||
* Use CheckCreateBuilder to construct new transactions.
|
||||
*/
|
||||
class CheckCreate : public TransactionBase
|
||||
{
|
||||
public:
|
||||
static constexpr xrpl::TxType txType = ttCHECK_CREATE;
|
||||
|
||||
/**
|
||||
* Construct a CheckCreate transaction wrapper from an existing STTx object.
|
||||
* @throws std::runtime_error if the transaction type doesn't match.
|
||||
*/
|
||||
explicit CheckCreate(STTx const& tx)
|
||||
: TransactionBase(tx)
|
||||
{
|
||||
// Verify transaction type
|
||||
if (tx.getTxnType() != txType)
|
||||
{
|
||||
throw std::runtime_error("Invalid transaction type for CheckCreate");
|
||||
}
|
||||
}
|
||||
|
||||
// Transaction-specific field getters
|
||||
|
||||
/**
|
||||
* Get sfDestination (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_ACCOUNT::type::value_type
|
||||
getDestination() const
|
||||
{
|
||||
return this->tx_.at(sfDestination);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfSendMax (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_AMOUNT::type::value_type
|
||||
getSendMax() const
|
||||
{
|
||||
return this->tx_.at(sfSendMax);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfExpiration (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT32::type::value_type>
|
||||
getExpiration() const
|
||||
{
|
||||
if (hasExpiration())
|
||||
{
|
||||
return this->tx_.at(sfExpiration);
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasExpiration() const
|
||||
{
|
||||
return this->tx_.isFieldPresent(sfExpiration);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfDestinationTag (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT32::type::value_type>
|
||||
getDestinationTag() const
|
||||
{
|
||||
if (hasDestinationTag())
|
||||
{
|
||||
return this->tx_.at(sfDestinationTag);
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasDestinationTag() const
|
||||
{
|
||||
return this->tx_.isFieldPresent(sfDestinationTag);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfInvoiceID (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT256::type::value_type>
|
||||
getInvoiceID() const
|
||||
{
|
||||
if (hasInvoiceID())
|
||||
{
|
||||
return this->tx_.at(sfInvoiceID);
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasInvoiceID() const
|
||||
{
|
||||
return this->tx_.isFieldPresent(sfInvoiceID);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Builder for CheckCreate transactions.
|
||||
* Provides a fluent interface for constructing transactions with method chaining.
|
||||
* Uses Json::Value internally for flexible transaction construction.
|
||||
* Inherits common field setters from TransactionBuilderBase.
|
||||
*/
|
||||
class CheckCreateBuilder : public TransactionBuilderBase<CheckCreateBuilder>
|
||||
{
|
||||
public:
|
||||
CheckCreateBuilder(SF_ACCOUNT::type::value_type account,
|
||||
std::decay_t<typename SF_ACCOUNT::type::value_type> const& destination, std::decay_t<typename SF_AMOUNT::type::value_type> const& sendMax, std::optional<SF_UINT32::type::value_type> sequence = std::nullopt,
|
||||
std::optional<SF_AMOUNT::type::value_type> fee = std::nullopt
|
||||
)
|
||||
: TransactionBuilderBase<CheckCreateBuilder>(ttCHECK_CREATE, account, sequence, fee)
|
||||
{
|
||||
setDestination(destination);
|
||||
setSendMax(sendMax);
|
||||
}
|
||||
|
||||
CheckCreateBuilder(STTx const& tx)
|
||||
{
|
||||
if (tx.getTxnType() != ttCHECK_CREATE)
|
||||
{
|
||||
throw std::runtime_error("Invalid transaction type for CheckCreateBuilder");
|
||||
}
|
||||
object_ = tx;
|
||||
}
|
||||
|
||||
// Transaction-specific field setters
|
||||
|
||||
/**
|
||||
* Set sfDestination (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
CheckCreateBuilder&
|
||||
setDestination(std::decay_t<typename SF_ACCOUNT::type::value_type> const& value)
|
||||
{
|
||||
object_[sfDestination] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfSendMax (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
CheckCreateBuilder&
|
||||
setSendMax(std::decay_t<typename SF_AMOUNT::type::value_type> const& value)
|
||||
{
|
||||
object_[sfSendMax] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfExpiration (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
CheckCreateBuilder&
|
||||
setExpiration(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfExpiration] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfDestinationTag (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
CheckCreateBuilder&
|
||||
setDestinationTag(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfDestinationTag] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfInvoiceID (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
CheckCreateBuilder&
|
||||
setInvoiceID(std::decay_t<typename SF_UINT256::type::value_type> const& value)
|
||||
{
|
||||
object_[sfInvoiceID] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build and return the completed CheckCreate wrapper.
|
||||
* @return The constructed transaction wrapper.
|
||||
* @throws std::runtime_error if the JSON cannot be parsed into a valid transaction.
|
||||
*/
|
||||
CheckCreate
|
||||
build()
|
||||
{
|
||||
return CheckCreate(STTx(std::move(object_)));
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::transactions
|
||||
@@ -1,146 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STTx.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/TransactionBase.h>
|
||||
#include <xrpl/protocol_autogen/TransactionBuilderBase.h>
|
||||
#include <xrpl/json/json_value.h>
|
||||
|
||||
#include <stdexcept>
|
||||
#include <optional>
|
||||
|
||||
namespace xrpl::transactions {
|
||||
|
||||
// Forward declaration
|
||||
class ClawbackBuilder;
|
||||
|
||||
/**
|
||||
* Transaction: Clawback
|
||||
* Type: ttCLAWBACK (30)
|
||||
* Delegable: Delegation::delegable
|
||||
* Amendment: featureClawback
|
||||
* Privileges: noPriv
|
||||
*
|
||||
* Immutable wrapper around STTx providing type-safe field access.
|
||||
* Use ClawbackBuilder to construct new transactions.
|
||||
*/
|
||||
class Clawback : public TransactionBase
|
||||
{
|
||||
public:
|
||||
static constexpr xrpl::TxType txType = ttCLAWBACK;
|
||||
|
||||
/**
|
||||
* Construct a Clawback transaction wrapper from an existing STTx object.
|
||||
* @throws std::runtime_error if the transaction type doesn't match.
|
||||
*/
|
||||
explicit Clawback(STTx const& tx)
|
||||
: TransactionBase(tx)
|
||||
{
|
||||
// Verify transaction type
|
||||
if (tx.getTxnType() != txType)
|
||||
{
|
||||
throw std::runtime_error("Invalid transaction type for Clawback");
|
||||
}
|
||||
}
|
||||
|
||||
// Transaction-specific field getters
|
||||
|
||||
/**
|
||||
* Get sfAmount (soeREQUIRED)
|
||||
* Note: This field supports MPT (Multi-Purpose Token) amounts.
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_AMOUNT::type::value_type
|
||||
getAmount() const
|
||||
{
|
||||
return this->tx_.at(sfAmount);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfHolder (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_ACCOUNT::type::value_type>
|
||||
getHolder() const
|
||||
{
|
||||
if (hasHolder())
|
||||
{
|
||||
return this->tx_.at(sfHolder);
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasHolder() const
|
||||
{
|
||||
return this->tx_.isFieldPresent(sfHolder);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Builder for Clawback transactions.
|
||||
* Provides a fluent interface for constructing transactions with method chaining.
|
||||
* Uses Json::Value internally for flexible transaction construction.
|
||||
* Inherits common field setters from TransactionBuilderBase.
|
||||
*/
|
||||
class ClawbackBuilder : public TransactionBuilderBase<ClawbackBuilder>
|
||||
{
|
||||
public:
|
||||
ClawbackBuilder(SF_ACCOUNT::type::value_type account,
|
||||
std::decay_t<typename SF_AMOUNT::type::value_type> const& amount, std::optional<SF_UINT32::type::value_type> sequence = std::nullopt,
|
||||
std::optional<SF_AMOUNT::type::value_type> fee = std::nullopt
|
||||
)
|
||||
: TransactionBuilderBase<ClawbackBuilder>(ttCLAWBACK, account, sequence, fee)
|
||||
{
|
||||
setAmount(amount);
|
||||
}
|
||||
|
||||
ClawbackBuilder(STTx const& tx)
|
||||
{
|
||||
if (tx.getTxnType() != ttCLAWBACK)
|
||||
{
|
||||
throw std::runtime_error("Invalid transaction type for ClawbackBuilder");
|
||||
}
|
||||
object_ = tx;
|
||||
}
|
||||
|
||||
// Transaction-specific field setters
|
||||
|
||||
/**
|
||||
* Set sfAmount (soeREQUIRED)
|
||||
* Note: This field supports MPT (Multi-Purpose Token) amounts.
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
ClawbackBuilder&
|
||||
setAmount(std::decay_t<typename SF_AMOUNT::type::value_type> const& value)
|
||||
{
|
||||
object_[sfAmount] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfHolder (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
ClawbackBuilder&
|
||||
setHolder(std::decay_t<typename SF_ACCOUNT::type::value_type> const& value)
|
||||
{
|
||||
object_[sfHolder] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build and return the completed Clawback wrapper.
|
||||
* @return The constructed transaction wrapper.
|
||||
* @throws std::runtime_error if the JSON cannot be parsed into a valid transaction.
|
||||
*/
|
||||
Clawback
|
||||
build()
|
||||
{
|
||||
return Clawback(STTx(std::move(object_)));
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::transactions
|
||||
@@ -1,134 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STTx.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/TransactionBase.h>
|
||||
#include <xrpl/protocol_autogen/TransactionBuilderBase.h>
|
||||
#include <xrpl/json/json_value.h>
|
||||
|
||||
#include <stdexcept>
|
||||
#include <optional>
|
||||
|
||||
namespace xrpl::transactions {
|
||||
|
||||
// Forward declaration
|
||||
class CredentialAcceptBuilder;
|
||||
|
||||
/**
|
||||
* Transaction: CredentialAccept
|
||||
* Type: ttCREDENTIAL_ACCEPT (59)
|
||||
* Delegable: Delegation::delegable
|
||||
* Amendment: featureCredentials
|
||||
* Privileges: noPriv
|
||||
*
|
||||
* Immutable wrapper around STTx providing type-safe field access.
|
||||
* Use CredentialAcceptBuilder to construct new transactions.
|
||||
*/
|
||||
class CredentialAccept : public TransactionBase
|
||||
{
|
||||
public:
|
||||
static constexpr xrpl::TxType txType = ttCREDENTIAL_ACCEPT;
|
||||
|
||||
/**
|
||||
* Construct a CredentialAccept transaction wrapper from an existing STTx object.
|
||||
* @throws std::runtime_error if the transaction type doesn't match.
|
||||
*/
|
||||
explicit CredentialAccept(STTx const& tx)
|
||||
: TransactionBase(tx)
|
||||
{
|
||||
// Verify transaction type
|
||||
if (tx.getTxnType() != txType)
|
||||
{
|
||||
throw std::runtime_error("Invalid transaction type for CredentialAccept");
|
||||
}
|
||||
}
|
||||
|
||||
// Transaction-specific field getters
|
||||
|
||||
/**
|
||||
* Get sfIssuer (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_ACCOUNT::type::value_type
|
||||
getIssuer() const
|
||||
{
|
||||
return this->tx_.at(sfIssuer);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfCredentialType (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_VL::type::value_type
|
||||
getCredentialType() const
|
||||
{
|
||||
return this->tx_.at(sfCredentialType);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Builder for CredentialAccept transactions.
|
||||
* Provides a fluent interface for constructing transactions with method chaining.
|
||||
* Uses Json::Value internally for flexible transaction construction.
|
||||
* Inherits common field setters from TransactionBuilderBase.
|
||||
*/
|
||||
class CredentialAcceptBuilder : public TransactionBuilderBase<CredentialAcceptBuilder>
|
||||
{
|
||||
public:
|
||||
CredentialAcceptBuilder(SF_ACCOUNT::type::value_type account,
|
||||
std::decay_t<typename SF_ACCOUNT::type::value_type> const& issuer, std::decay_t<typename SF_VL::type::value_type> const& credentialType, std::optional<SF_UINT32::type::value_type> sequence = std::nullopt,
|
||||
std::optional<SF_AMOUNT::type::value_type> fee = std::nullopt
|
||||
)
|
||||
: TransactionBuilderBase<CredentialAcceptBuilder>(ttCREDENTIAL_ACCEPT, account, sequence, fee)
|
||||
{
|
||||
setIssuer(issuer);
|
||||
setCredentialType(credentialType);
|
||||
}
|
||||
|
||||
CredentialAcceptBuilder(STTx const& tx)
|
||||
{
|
||||
if (tx.getTxnType() != ttCREDENTIAL_ACCEPT)
|
||||
{
|
||||
throw std::runtime_error("Invalid transaction type for CredentialAcceptBuilder");
|
||||
}
|
||||
object_ = tx;
|
||||
}
|
||||
|
||||
// Transaction-specific field setters
|
||||
|
||||
/**
|
||||
* Set sfIssuer (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
CredentialAcceptBuilder&
|
||||
setIssuer(std::decay_t<typename SF_ACCOUNT::type::value_type> const& value)
|
||||
{
|
||||
object_[sfIssuer] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfCredentialType (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
CredentialAcceptBuilder&
|
||||
setCredentialType(std::decay_t<typename SF_VL::type::value_type> const& value)
|
||||
{
|
||||
object_[sfCredentialType] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build and return the completed CredentialAccept wrapper.
|
||||
* @return The constructed transaction wrapper.
|
||||
* @throws std::runtime_error if the JSON cannot be parsed into a valid transaction.
|
||||
*/
|
||||
CredentialAccept
|
||||
build()
|
||||
{
|
||||
return CredentialAccept(STTx(std::move(object_)));
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::transactions
|
||||
@@ -1,198 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STTx.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/TransactionBase.h>
|
||||
#include <xrpl/protocol_autogen/TransactionBuilderBase.h>
|
||||
#include <xrpl/json/json_value.h>
|
||||
|
||||
#include <stdexcept>
|
||||
#include <optional>
|
||||
|
||||
namespace xrpl::transactions {
|
||||
|
||||
// Forward declaration
|
||||
class CredentialCreateBuilder;
|
||||
|
||||
/**
|
||||
* Transaction: CredentialCreate
|
||||
* Type: ttCREDENTIAL_CREATE (58)
|
||||
* Delegable: Delegation::delegable
|
||||
* Amendment: featureCredentials
|
||||
* Privileges: noPriv
|
||||
*
|
||||
* Immutable wrapper around STTx providing type-safe field access.
|
||||
* Use CredentialCreateBuilder to construct new transactions.
|
||||
*/
|
||||
class CredentialCreate : public TransactionBase
|
||||
{
|
||||
public:
|
||||
static constexpr xrpl::TxType txType = ttCREDENTIAL_CREATE;
|
||||
|
||||
/**
|
||||
* Construct a CredentialCreate transaction wrapper from an existing STTx object.
|
||||
* @throws std::runtime_error if the transaction type doesn't match.
|
||||
*/
|
||||
explicit CredentialCreate(STTx const& tx)
|
||||
: TransactionBase(tx)
|
||||
{
|
||||
// Verify transaction type
|
||||
if (tx.getTxnType() != txType)
|
||||
{
|
||||
throw std::runtime_error("Invalid transaction type for CredentialCreate");
|
||||
}
|
||||
}
|
||||
|
||||
// Transaction-specific field getters
|
||||
|
||||
/**
|
||||
* Get sfSubject (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_ACCOUNT::type::value_type
|
||||
getSubject() const
|
||||
{
|
||||
return this->tx_.at(sfSubject);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfCredentialType (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_VL::type::value_type
|
||||
getCredentialType() const
|
||||
{
|
||||
return this->tx_.at(sfCredentialType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfExpiration (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT32::type::value_type>
|
||||
getExpiration() const
|
||||
{
|
||||
if (hasExpiration())
|
||||
{
|
||||
return this->tx_.at(sfExpiration);
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasExpiration() const
|
||||
{
|
||||
return this->tx_.isFieldPresent(sfExpiration);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfURI (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_VL::type::value_type>
|
||||
getURI() const
|
||||
{
|
||||
if (hasURI())
|
||||
{
|
||||
return this->tx_.at(sfURI);
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasURI() const
|
||||
{
|
||||
return this->tx_.isFieldPresent(sfURI);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Builder for CredentialCreate transactions.
|
||||
* Provides a fluent interface for constructing transactions with method chaining.
|
||||
* Uses Json::Value internally for flexible transaction construction.
|
||||
* Inherits common field setters from TransactionBuilderBase.
|
||||
*/
|
||||
class CredentialCreateBuilder : public TransactionBuilderBase<CredentialCreateBuilder>
|
||||
{
|
||||
public:
|
||||
CredentialCreateBuilder(SF_ACCOUNT::type::value_type account,
|
||||
std::decay_t<typename SF_ACCOUNT::type::value_type> const& subject, std::decay_t<typename SF_VL::type::value_type> const& credentialType, std::optional<SF_UINT32::type::value_type> sequence = std::nullopt,
|
||||
std::optional<SF_AMOUNT::type::value_type> fee = std::nullopt
|
||||
)
|
||||
: TransactionBuilderBase<CredentialCreateBuilder>(ttCREDENTIAL_CREATE, account, sequence, fee)
|
||||
{
|
||||
setSubject(subject);
|
||||
setCredentialType(credentialType);
|
||||
}
|
||||
|
||||
CredentialCreateBuilder(STTx const& tx)
|
||||
{
|
||||
if (tx.getTxnType() != ttCREDENTIAL_CREATE)
|
||||
{
|
||||
throw std::runtime_error("Invalid transaction type for CredentialCreateBuilder");
|
||||
}
|
||||
object_ = tx;
|
||||
}
|
||||
|
||||
// Transaction-specific field setters
|
||||
|
||||
/**
|
||||
* Set sfSubject (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
CredentialCreateBuilder&
|
||||
setSubject(std::decay_t<typename SF_ACCOUNT::type::value_type> const& value)
|
||||
{
|
||||
object_[sfSubject] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfCredentialType (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
CredentialCreateBuilder&
|
||||
setCredentialType(std::decay_t<typename SF_VL::type::value_type> const& value)
|
||||
{
|
||||
object_[sfCredentialType] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfExpiration (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
CredentialCreateBuilder&
|
||||
setExpiration(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfExpiration] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfURI (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
CredentialCreateBuilder&
|
||||
setURI(std::decay_t<typename SF_VL::type::value_type> const& value)
|
||||
{
|
||||
object_[sfURI] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build and return the completed CredentialCreate wrapper.
|
||||
* @return The constructed transaction wrapper.
|
||||
* @throws std::runtime_error if the JSON cannot be parsed into a valid transaction.
|
||||
*/
|
||||
CredentialCreate
|
||||
build()
|
||||
{
|
||||
return CredentialCreate(STTx(std::move(object_)));
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::transactions
|
||||
@@ -1,176 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STTx.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/TransactionBase.h>
|
||||
#include <xrpl/protocol_autogen/TransactionBuilderBase.h>
|
||||
#include <xrpl/json/json_value.h>
|
||||
|
||||
#include <stdexcept>
|
||||
#include <optional>
|
||||
|
||||
namespace xrpl::transactions {
|
||||
|
||||
// Forward declaration
|
||||
class CredentialDeleteBuilder;
|
||||
|
||||
/**
|
||||
* Transaction: CredentialDelete
|
||||
* Type: ttCREDENTIAL_DELETE (60)
|
||||
* Delegable: Delegation::delegable
|
||||
* Amendment: featureCredentials
|
||||
* Privileges: noPriv
|
||||
*
|
||||
* Immutable wrapper around STTx providing type-safe field access.
|
||||
* Use CredentialDeleteBuilder to construct new transactions.
|
||||
*/
|
||||
class CredentialDelete : public TransactionBase
|
||||
{
|
||||
public:
|
||||
static constexpr xrpl::TxType txType = ttCREDENTIAL_DELETE;
|
||||
|
||||
/**
|
||||
* Construct a CredentialDelete transaction wrapper from an existing STTx object.
|
||||
* @throws std::runtime_error if the transaction type doesn't match.
|
||||
*/
|
||||
explicit CredentialDelete(STTx const& tx)
|
||||
: TransactionBase(tx)
|
||||
{
|
||||
// Verify transaction type
|
||||
if (tx.getTxnType() != txType)
|
||||
{
|
||||
throw std::runtime_error("Invalid transaction type for CredentialDelete");
|
||||
}
|
||||
}
|
||||
|
||||
// Transaction-specific field getters
|
||||
|
||||
/**
|
||||
* Get sfSubject (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_ACCOUNT::type::value_type>
|
||||
getSubject() const
|
||||
{
|
||||
if (hasSubject())
|
||||
{
|
||||
return this->tx_.at(sfSubject);
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasSubject() const
|
||||
{
|
||||
return this->tx_.isFieldPresent(sfSubject);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfIssuer (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_ACCOUNT::type::value_type>
|
||||
getIssuer() const
|
||||
{
|
||||
if (hasIssuer())
|
||||
{
|
||||
return this->tx_.at(sfIssuer);
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasIssuer() const
|
||||
{
|
||||
return this->tx_.isFieldPresent(sfIssuer);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfCredentialType (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_VL::type::value_type
|
||||
getCredentialType() const
|
||||
{
|
||||
return this->tx_.at(sfCredentialType);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Builder for CredentialDelete transactions.
|
||||
* Provides a fluent interface for constructing transactions with method chaining.
|
||||
* Uses Json::Value internally for flexible transaction construction.
|
||||
* Inherits common field setters from TransactionBuilderBase.
|
||||
*/
|
||||
class CredentialDeleteBuilder : public TransactionBuilderBase<CredentialDeleteBuilder>
|
||||
{
|
||||
public:
|
||||
CredentialDeleteBuilder(SF_ACCOUNT::type::value_type account,
|
||||
std::decay_t<typename SF_VL::type::value_type> const& credentialType, std::optional<SF_UINT32::type::value_type> sequence = std::nullopt,
|
||||
std::optional<SF_AMOUNT::type::value_type> fee = std::nullopt
|
||||
)
|
||||
: TransactionBuilderBase<CredentialDeleteBuilder>(ttCREDENTIAL_DELETE, account, sequence, fee)
|
||||
{
|
||||
setCredentialType(credentialType);
|
||||
}
|
||||
|
||||
CredentialDeleteBuilder(STTx const& tx)
|
||||
{
|
||||
if (tx.getTxnType() != ttCREDENTIAL_DELETE)
|
||||
{
|
||||
throw std::runtime_error("Invalid transaction type for CredentialDeleteBuilder");
|
||||
}
|
||||
object_ = tx;
|
||||
}
|
||||
|
||||
// Transaction-specific field setters
|
||||
|
||||
/**
|
||||
* Set sfSubject (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
CredentialDeleteBuilder&
|
||||
setSubject(std::decay_t<typename SF_ACCOUNT::type::value_type> const& value)
|
||||
{
|
||||
object_[sfSubject] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfIssuer (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
CredentialDeleteBuilder&
|
||||
setIssuer(std::decay_t<typename SF_ACCOUNT::type::value_type> const& value)
|
||||
{
|
||||
object_[sfIssuer] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfCredentialType (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
CredentialDeleteBuilder&
|
||||
setCredentialType(std::decay_t<typename SF_VL::type::value_type> const& value)
|
||||
{
|
||||
object_[sfCredentialType] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build and return the completed CredentialDelete wrapper.
|
||||
* @return The constructed transaction wrapper.
|
||||
* @throws std::runtime_error if the JSON cannot be parsed into a valid transaction.
|
||||
*/
|
||||
CredentialDelete
|
||||
build()
|
||||
{
|
||||
return CredentialDelete(STTx(std::move(object_)));
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::transactions
|
||||
@@ -1,90 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STTx.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/TransactionBase.h>
|
||||
#include <xrpl/protocol_autogen/TransactionBuilderBase.h>
|
||||
#include <xrpl/json/json_value.h>
|
||||
|
||||
#include <stdexcept>
|
||||
#include <optional>
|
||||
|
||||
namespace xrpl::transactions {
|
||||
|
||||
// Forward declaration
|
||||
class DIDDeleteBuilder;
|
||||
|
||||
/**
|
||||
* Transaction: DIDDelete
|
||||
* Type: ttDID_DELETE (50)
|
||||
* Delegable: Delegation::delegable
|
||||
* Amendment: featureDID
|
||||
* Privileges: noPriv
|
||||
*
|
||||
* Immutable wrapper around STTx providing type-safe field access.
|
||||
* Use DIDDeleteBuilder to construct new transactions.
|
||||
*/
|
||||
class DIDDelete : public TransactionBase
|
||||
{
|
||||
public:
|
||||
static constexpr xrpl::TxType txType = ttDID_DELETE;
|
||||
|
||||
/**
|
||||
* Construct a DIDDelete transaction wrapper from an existing STTx object.
|
||||
* @throws std::runtime_error if the transaction type doesn't match.
|
||||
*/
|
||||
explicit DIDDelete(STTx const& tx)
|
||||
: TransactionBase(tx)
|
||||
{
|
||||
// Verify transaction type
|
||||
if (tx.getTxnType() != txType)
|
||||
{
|
||||
throw std::runtime_error("Invalid transaction type for DIDDelete");
|
||||
}
|
||||
}
|
||||
|
||||
// Transaction-specific field getters
|
||||
};
|
||||
|
||||
/**
|
||||
* Builder for DIDDelete transactions.
|
||||
* Provides a fluent interface for constructing transactions with method chaining.
|
||||
* Uses Json::Value internally for flexible transaction construction.
|
||||
* Inherits common field setters from TransactionBuilderBase.
|
||||
*/
|
||||
class DIDDeleteBuilder : public TransactionBuilderBase<DIDDeleteBuilder>
|
||||
{
|
||||
public:
|
||||
DIDDeleteBuilder(SF_ACCOUNT::type::value_type account,
|
||||
std::optional<SF_UINT32::type::value_type> sequence = std::nullopt,
|
||||
std::optional<SF_AMOUNT::type::value_type> fee = std::nullopt
|
||||
)
|
||||
: TransactionBuilderBase<DIDDeleteBuilder>(ttDID_DELETE, account, sequence, fee)
|
||||
{
|
||||
}
|
||||
|
||||
DIDDeleteBuilder(STTx const& tx)
|
||||
{
|
||||
if (tx.getTxnType() != ttDID_DELETE)
|
||||
{
|
||||
throw std::runtime_error("Invalid transaction type for DIDDeleteBuilder");
|
||||
}
|
||||
object_ = tx;
|
||||
}
|
||||
|
||||
// Transaction-specific field setters
|
||||
|
||||
/**
|
||||
* Build and return the completed DIDDelete wrapper.
|
||||
* @return The constructed transaction wrapper.
|
||||
* @throws std::runtime_error if the JSON cannot be parsed into a valid transaction.
|
||||
*/
|
||||
DIDDelete
|
||||
build()
|
||||
{
|
||||
return DIDDelete(STTx(std::move(object_)));
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::transactions
|
||||
@@ -1,186 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STTx.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/TransactionBase.h>
|
||||
#include <xrpl/protocol_autogen/TransactionBuilderBase.h>
|
||||
#include <xrpl/json/json_value.h>
|
||||
|
||||
#include <stdexcept>
|
||||
#include <optional>
|
||||
|
||||
namespace xrpl::transactions {
|
||||
|
||||
// Forward declaration
|
||||
class DIDSetBuilder;
|
||||
|
||||
/**
|
||||
* Transaction: DIDSet
|
||||
* Type: ttDID_SET (49)
|
||||
* Delegable: Delegation::delegable
|
||||
* Amendment: featureDID
|
||||
* Privileges: noPriv
|
||||
*
|
||||
* Immutable wrapper around STTx providing type-safe field access.
|
||||
* Use DIDSetBuilder to construct new transactions.
|
||||
*/
|
||||
class DIDSet : public TransactionBase
|
||||
{
|
||||
public:
|
||||
static constexpr xrpl::TxType txType = ttDID_SET;
|
||||
|
||||
/**
|
||||
* Construct a DIDSet transaction wrapper from an existing STTx object.
|
||||
* @throws std::runtime_error if the transaction type doesn't match.
|
||||
*/
|
||||
explicit DIDSet(STTx const& tx)
|
||||
: TransactionBase(tx)
|
||||
{
|
||||
// Verify transaction type
|
||||
if (tx.getTxnType() != txType)
|
||||
{
|
||||
throw std::runtime_error("Invalid transaction type for DIDSet");
|
||||
}
|
||||
}
|
||||
|
||||
// Transaction-specific field getters
|
||||
|
||||
/**
|
||||
* Get sfDIDDocument (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_VL::type::value_type>
|
||||
getDIDDocument() const
|
||||
{
|
||||
if (hasDIDDocument())
|
||||
{
|
||||
return this->tx_.at(sfDIDDocument);
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasDIDDocument() const
|
||||
{
|
||||
return this->tx_.isFieldPresent(sfDIDDocument);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfURI (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_VL::type::value_type>
|
||||
getURI() const
|
||||
{
|
||||
if (hasURI())
|
||||
{
|
||||
return this->tx_.at(sfURI);
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasURI() const
|
||||
{
|
||||
return this->tx_.isFieldPresent(sfURI);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfData (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_VL::type::value_type>
|
||||
getData() const
|
||||
{
|
||||
if (hasData())
|
||||
{
|
||||
return this->tx_.at(sfData);
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasData() const
|
||||
{
|
||||
return this->tx_.isFieldPresent(sfData);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Builder for DIDSet transactions.
|
||||
* Provides a fluent interface for constructing transactions with method chaining.
|
||||
* Uses Json::Value internally for flexible transaction construction.
|
||||
* Inherits common field setters from TransactionBuilderBase.
|
||||
*/
|
||||
class DIDSetBuilder : public TransactionBuilderBase<DIDSetBuilder>
|
||||
{
|
||||
public:
|
||||
DIDSetBuilder(SF_ACCOUNT::type::value_type account,
|
||||
std::optional<SF_UINT32::type::value_type> sequence = std::nullopt,
|
||||
std::optional<SF_AMOUNT::type::value_type> fee = std::nullopt
|
||||
)
|
||||
: TransactionBuilderBase<DIDSetBuilder>(ttDID_SET, account, sequence, fee)
|
||||
{
|
||||
}
|
||||
|
||||
DIDSetBuilder(STTx const& tx)
|
||||
{
|
||||
if (tx.getTxnType() != ttDID_SET)
|
||||
{
|
||||
throw std::runtime_error("Invalid transaction type for DIDSetBuilder");
|
||||
}
|
||||
object_ = tx;
|
||||
}
|
||||
|
||||
// Transaction-specific field setters
|
||||
|
||||
/**
|
||||
* Set sfDIDDocument (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
DIDSetBuilder&
|
||||
setDIDDocument(std::decay_t<typename SF_VL::type::value_type> const& value)
|
||||
{
|
||||
object_[sfDIDDocument] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfURI (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
DIDSetBuilder&
|
||||
setURI(std::decay_t<typename SF_VL::type::value_type> const& value)
|
||||
{
|
||||
object_[sfURI] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfData (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
DIDSetBuilder&
|
||||
setData(std::decay_t<typename SF_VL::type::value_type> const& value)
|
||||
{
|
||||
object_[sfData] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build and return the completed DIDSet wrapper.
|
||||
* @return The constructed transaction wrapper.
|
||||
* @throws std::runtime_error if the JSON cannot be parsed into a valid transaction.
|
||||
*/
|
||||
DIDSet
|
||||
build()
|
||||
{
|
||||
return DIDSet(STTx(std::move(object_)));
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::transactions
|
||||
@@ -1,134 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STTx.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/TransactionBase.h>
|
||||
#include <xrpl/protocol_autogen/TransactionBuilderBase.h>
|
||||
#include <xrpl/json/json_value.h>
|
||||
|
||||
#include <stdexcept>
|
||||
#include <optional>
|
||||
|
||||
namespace xrpl::transactions {
|
||||
|
||||
// Forward declaration
|
||||
class DelegateSetBuilder;
|
||||
|
||||
/**
|
||||
* Transaction: DelegateSet
|
||||
* Type: ttDELEGATE_SET (64)
|
||||
* Delegable: Delegation::notDelegable
|
||||
* Amendment: featurePermissionDelegationV1_1
|
||||
* Privileges: noPriv
|
||||
*
|
||||
* Immutable wrapper around STTx providing type-safe field access.
|
||||
* Use DelegateSetBuilder to construct new transactions.
|
||||
*/
|
||||
class DelegateSet : public TransactionBase
|
||||
{
|
||||
public:
|
||||
static constexpr xrpl::TxType txType = ttDELEGATE_SET;
|
||||
|
||||
/**
|
||||
* Construct a DelegateSet transaction wrapper from an existing STTx object.
|
||||
* @throws std::runtime_error if the transaction type doesn't match.
|
||||
*/
|
||||
explicit DelegateSet(STTx const& tx)
|
||||
: TransactionBase(tx)
|
||||
{
|
||||
// Verify transaction type
|
||||
if (tx.getTxnType() != txType)
|
||||
{
|
||||
throw std::runtime_error("Invalid transaction type for DelegateSet");
|
||||
}
|
||||
}
|
||||
|
||||
// Transaction-specific field getters
|
||||
|
||||
/**
|
||||
* Get sfAuthorize (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_ACCOUNT::type::value_type
|
||||
getAuthorize() const
|
||||
{
|
||||
return this->tx_.at(sfAuthorize);
|
||||
}
|
||||
/**
|
||||
* Get sfPermissions (soeREQUIRED)
|
||||
* Note: This is an untyped field
|
||||
*/
|
||||
[[nodiscard]]
|
||||
STArray const&
|
||||
getPermissions() const
|
||||
{
|
||||
return this->tx_.getFieldArray(sfPermissions);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Builder for DelegateSet transactions.
|
||||
* Provides a fluent interface for constructing transactions with method chaining.
|
||||
* Uses Json::Value internally for flexible transaction construction.
|
||||
* Inherits common field setters from TransactionBuilderBase.
|
||||
*/
|
||||
class DelegateSetBuilder : public TransactionBuilderBase<DelegateSetBuilder>
|
||||
{
|
||||
public:
|
||||
DelegateSetBuilder(SF_ACCOUNT::type::value_type account,
|
||||
std::decay_t<typename SF_ACCOUNT::type::value_type> const& authorize, STArray const& permissions, std::optional<SF_UINT32::type::value_type> sequence = std::nullopt,
|
||||
std::optional<SF_AMOUNT::type::value_type> fee = std::nullopt
|
||||
)
|
||||
: TransactionBuilderBase<DelegateSetBuilder>(ttDELEGATE_SET, account, sequence, fee)
|
||||
{
|
||||
setAuthorize(authorize);
|
||||
setPermissions(permissions);
|
||||
}
|
||||
|
||||
DelegateSetBuilder(STTx const& tx)
|
||||
{
|
||||
if (tx.getTxnType() != ttDELEGATE_SET)
|
||||
{
|
||||
throw std::runtime_error("Invalid transaction type for DelegateSetBuilder");
|
||||
}
|
||||
object_ = tx;
|
||||
}
|
||||
|
||||
// Transaction-specific field setters
|
||||
|
||||
/**
|
||||
* Set sfAuthorize (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
DelegateSetBuilder&
|
||||
setAuthorize(std::decay_t<typename SF_ACCOUNT::type::value_type> const& value)
|
||||
{
|
||||
object_[sfAuthorize] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfPermissions (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
DelegateSetBuilder&
|
||||
setPermissions(STArray const& value)
|
||||
{
|
||||
object_.setFieldArray(sfPermissions, value);
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build and return the completed DelegateSet wrapper.
|
||||
* @return The constructed transaction wrapper.
|
||||
* @throws std::runtime_error if the JSON cannot be parsed into a valid transaction.
|
||||
*/
|
||||
DelegateSet
|
||||
build()
|
||||
{
|
||||
return DelegateSet(STTx(std::move(object_)));
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::transactions
|
||||
@@ -1,214 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STTx.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/TransactionBase.h>
|
||||
#include <xrpl/protocol_autogen/TransactionBuilderBase.h>
|
||||
#include <xrpl/json/json_value.h>
|
||||
|
||||
#include <stdexcept>
|
||||
#include <optional>
|
||||
|
||||
namespace xrpl::transactions {
|
||||
|
||||
// Forward declaration
|
||||
class DepositPreauthBuilder;
|
||||
|
||||
/**
|
||||
* Transaction: DepositPreauth
|
||||
* Type: ttDEPOSIT_PREAUTH (19)
|
||||
* Delegable: Delegation::delegable
|
||||
* Amendment: uint256{}
|
||||
* Privileges: noPriv
|
||||
*
|
||||
* Immutable wrapper around STTx providing type-safe field access.
|
||||
* Use DepositPreauthBuilder to construct new transactions.
|
||||
*/
|
||||
class DepositPreauth : public TransactionBase
|
||||
{
|
||||
public:
|
||||
static constexpr xrpl::TxType txType = ttDEPOSIT_PREAUTH;
|
||||
|
||||
/**
|
||||
* Construct a DepositPreauth transaction wrapper from an existing STTx object.
|
||||
* @throws std::runtime_error if the transaction type doesn't match.
|
||||
*/
|
||||
explicit DepositPreauth(STTx const& tx)
|
||||
: TransactionBase(tx)
|
||||
{
|
||||
// Verify transaction type
|
||||
if (tx.getTxnType() != txType)
|
||||
{
|
||||
throw std::runtime_error("Invalid transaction type for DepositPreauth");
|
||||
}
|
||||
}
|
||||
|
||||
// Transaction-specific field getters
|
||||
|
||||
/**
|
||||
* Get sfAuthorize (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_ACCOUNT::type::value_type>
|
||||
getAuthorize() const
|
||||
{
|
||||
if (hasAuthorize())
|
||||
{
|
||||
return this->tx_.at(sfAuthorize);
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasAuthorize() const
|
||||
{
|
||||
return this->tx_.isFieldPresent(sfAuthorize);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfUnauthorize (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_ACCOUNT::type::value_type>
|
||||
getUnauthorize() const
|
||||
{
|
||||
if (hasUnauthorize())
|
||||
{
|
||||
return this->tx_.at(sfUnauthorize);
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasUnauthorize() const
|
||||
{
|
||||
return this->tx_.isFieldPresent(sfUnauthorize);
|
||||
}
|
||||
/**
|
||||
* Get sfAuthorizeCredentials (soeOPTIONAL)
|
||||
* Note: This is an untyped field
|
||||
*/
|
||||
[[nodiscard]]
|
||||
std::optional<std::reference_wrapper<STArray const>>
|
||||
getAuthorizeCredentials() const
|
||||
{
|
||||
if (this->tx_.isFieldPresent(sfAuthorizeCredentials))
|
||||
return this->tx_.getFieldArray(sfAuthorizeCredentials);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasAuthorizeCredentials() const
|
||||
{
|
||||
return this->tx_.isFieldPresent(sfAuthorizeCredentials);
|
||||
}
|
||||
/**
|
||||
* Get sfUnauthorizeCredentials (soeOPTIONAL)
|
||||
* Note: This is an untyped field
|
||||
*/
|
||||
[[nodiscard]]
|
||||
std::optional<std::reference_wrapper<STArray const>>
|
||||
getUnauthorizeCredentials() const
|
||||
{
|
||||
if (this->tx_.isFieldPresent(sfUnauthorizeCredentials))
|
||||
return this->tx_.getFieldArray(sfUnauthorizeCredentials);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasUnauthorizeCredentials() const
|
||||
{
|
||||
return this->tx_.isFieldPresent(sfUnauthorizeCredentials);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Builder for DepositPreauth transactions.
|
||||
* Provides a fluent interface for constructing transactions with method chaining.
|
||||
* Uses Json::Value internally for flexible transaction construction.
|
||||
* Inherits common field setters from TransactionBuilderBase.
|
||||
*/
|
||||
class DepositPreauthBuilder : public TransactionBuilderBase<DepositPreauthBuilder>
|
||||
{
|
||||
public:
|
||||
DepositPreauthBuilder(SF_ACCOUNT::type::value_type account,
|
||||
std::optional<SF_UINT32::type::value_type> sequence = std::nullopt,
|
||||
std::optional<SF_AMOUNT::type::value_type> fee = std::nullopt
|
||||
)
|
||||
: TransactionBuilderBase<DepositPreauthBuilder>(ttDEPOSIT_PREAUTH, account, sequence, fee)
|
||||
{
|
||||
}
|
||||
|
||||
DepositPreauthBuilder(STTx const& tx)
|
||||
{
|
||||
if (tx.getTxnType() != ttDEPOSIT_PREAUTH)
|
||||
{
|
||||
throw std::runtime_error("Invalid transaction type for DepositPreauthBuilder");
|
||||
}
|
||||
object_ = tx;
|
||||
}
|
||||
|
||||
// Transaction-specific field setters
|
||||
|
||||
/**
|
||||
* Set sfAuthorize (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
DepositPreauthBuilder&
|
||||
setAuthorize(std::decay_t<typename SF_ACCOUNT::type::value_type> const& value)
|
||||
{
|
||||
object_[sfAuthorize] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfUnauthorize (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
DepositPreauthBuilder&
|
||||
setUnauthorize(std::decay_t<typename SF_ACCOUNT::type::value_type> const& value)
|
||||
{
|
||||
object_[sfUnauthorize] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfAuthorizeCredentials (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
DepositPreauthBuilder&
|
||||
setAuthorizeCredentials(STArray const& value)
|
||||
{
|
||||
object_.setFieldArray(sfAuthorizeCredentials, value);
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfUnauthorizeCredentials (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
DepositPreauthBuilder&
|
||||
setUnauthorizeCredentials(STArray const& value)
|
||||
{
|
||||
object_.setFieldArray(sfUnauthorizeCredentials, value);
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build and return the completed DepositPreauth wrapper.
|
||||
* @return The constructed transaction wrapper.
|
||||
* @throws std::runtime_error if the JSON cannot be parsed into a valid transaction.
|
||||
*/
|
||||
DepositPreauth
|
||||
build()
|
||||
{
|
||||
return DepositPreauth(STTx(std::move(object_)));
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::transactions
|
||||
@@ -1,134 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STTx.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/TransactionBase.h>
|
||||
#include <xrpl/protocol_autogen/TransactionBuilderBase.h>
|
||||
#include <xrpl/json/json_value.h>
|
||||
|
||||
#include <stdexcept>
|
||||
#include <optional>
|
||||
|
||||
namespace xrpl::transactions {
|
||||
|
||||
// Forward declaration
|
||||
class EnableAmendmentBuilder;
|
||||
|
||||
/**
|
||||
* Transaction: EnableAmendment
|
||||
* Type: ttAMENDMENT (100)
|
||||
* Delegable: Delegation::notDelegable
|
||||
* Amendment: uint256{}
|
||||
* Privileges: noPriv
|
||||
*
|
||||
* Immutable wrapper around STTx providing type-safe field access.
|
||||
* Use EnableAmendmentBuilder to construct new transactions.
|
||||
*/
|
||||
class EnableAmendment : public TransactionBase
|
||||
{
|
||||
public:
|
||||
static constexpr xrpl::TxType txType = ttAMENDMENT;
|
||||
|
||||
/**
|
||||
* Construct a EnableAmendment transaction wrapper from an existing STTx object.
|
||||
* @throws std::runtime_error if the transaction type doesn't match.
|
||||
*/
|
||||
explicit EnableAmendment(STTx const& tx)
|
||||
: TransactionBase(tx)
|
||||
{
|
||||
// Verify transaction type
|
||||
if (tx.getTxnType() != txType)
|
||||
{
|
||||
throw std::runtime_error("Invalid transaction type for EnableAmendment");
|
||||
}
|
||||
}
|
||||
|
||||
// Transaction-specific field getters
|
||||
|
||||
/**
|
||||
* Get sfLedgerSequence (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT32::type::value_type
|
||||
getLedgerSequence() const
|
||||
{
|
||||
return this->tx_.at(sfLedgerSequence);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfAmendment (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT256::type::value_type
|
||||
getAmendment() const
|
||||
{
|
||||
return this->tx_.at(sfAmendment);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Builder for EnableAmendment transactions.
|
||||
* Provides a fluent interface for constructing transactions with method chaining.
|
||||
* Uses Json::Value internally for flexible transaction construction.
|
||||
* Inherits common field setters from TransactionBuilderBase.
|
||||
*/
|
||||
class EnableAmendmentBuilder : public TransactionBuilderBase<EnableAmendmentBuilder>
|
||||
{
|
||||
public:
|
||||
EnableAmendmentBuilder(SF_ACCOUNT::type::value_type account,
|
||||
std::decay_t<typename SF_UINT32::type::value_type> const& ledgerSequence, std::decay_t<typename SF_UINT256::type::value_type> const& amendment, std::optional<SF_UINT32::type::value_type> sequence = std::nullopt,
|
||||
std::optional<SF_AMOUNT::type::value_type> fee = std::nullopt
|
||||
)
|
||||
: TransactionBuilderBase<EnableAmendmentBuilder>(ttAMENDMENT, account, sequence, fee)
|
||||
{
|
||||
setLedgerSequence(ledgerSequence);
|
||||
setAmendment(amendment);
|
||||
}
|
||||
|
||||
EnableAmendmentBuilder(STTx const& tx)
|
||||
{
|
||||
if (tx.getTxnType() != ttAMENDMENT)
|
||||
{
|
||||
throw std::runtime_error("Invalid transaction type for EnableAmendmentBuilder");
|
||||
}
|
||||
object_ = tx;
|
||||
}
|
||||
|
||||
// Transaction-specific field setters
|
||||
|
||||
/**
|
||||
* Set sfLedgerSequence (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
EnableAmendmentBuilder&
|
||||
setLedgerSequence(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfLedgerSequence] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfAmendment (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
EnableAmendmentBuilder&
|
||||
setAmendment(std::decay_t<typename SF_UINT256::type::value_type> const& value)
|
||||
{
|
||||
object_[sfAmendment] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build and return the completed EnableAmendment wrapper.
|
||||
* @return The constructed transaction wrapper.
|
||||
* @throws std::runtime_error if the JSON cannot be parsed into a valid transaction.
|
||||
*/
|
||||
EnableAmendment
|
||||
build()
|
||||
{
|
||||
return EnableAmendment(STTx(std::move(object_)));
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::transactions
|
||||
@@ -1,134 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STTx.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/TransactionBase.h>
|
||||
#include <xrpl/protocol_autogen/TransactionBuilderBase.h>
|
||||
#include <xrpl/json/json_value.h>
|
||||
|
||||
#include <stdexcept>
|
||||
#include <optional>
|
||||
|
||||
namespace xrpl::transactions {
|
||||
|
||||
// Forward declaration
|
||||
class EscrowCancelBuilder;
|
||||
|
||||
/**
|
||||
* Transaction: EscrowCancel
|
||||
* Type: ttESCROW_CANCEL (4)
|
||||
* Delegable: Delegation::delegable
|
||||
* Amendment: uint256{}
|
||||
* Privileges: noPriv
|
||||
*
|
||||
* Immutable wrapper around STTx providing type-safe field access.
|
||||
* Use EscrowCancelBuilder to construct new transactions.
|
||||
*/
|
||||
class EscrowCancel : public TransactionBase
|
||||
{
|
||||
public:
|
||||
static constexpr xrpl::TxType txType = ttESCROW_CANCEL;
|
||||
|
||||
/**
|
||||
* Construct a EscrowCancel transaction wrapper from an existing STTx object.
|
||||
* @throws std::runtime_error if the transaction type doesn't match.
|
||||
*/
|
||||
explicit EscrowCancel(STTx const& tx)
|
||||
: TransactionBase(tx)
|
||||
{
|
||||
// Verify transaction type
|
||||
if (tx.getTxnType() != txType)
|
||||
{
|
||||
throw std::runtime_error("Invalid transaction type for EscrowCancel");
|
||||
}
|
||||
}
|
||||
|
||||
// Transaction-specific field getters
|
||||
|
||||
/**
|
||||
* Get sfOwner (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_ACCOUNT::type::value_type
|
||||
getOwner() const
|
||||
{
|
||||
return this->tx_.at(sfOwner);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfOfferSequence (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT32::type::value_type
|
||||
getOfferSequence() const
|
||||
{
|
||||
return this->tx_.at(sfOfferSequence);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Builder for EscrowCancel transactions.
|
||||
* Provides a fluent interface for constructing transactions with method chaining.
|
||||
* Uses Json::Value internally for flexible transaction construction.
|
||||
* Inherits common field setters from TransactionBuilderBase.
|
||||
*/
|
||||
class EscrowCancelBuilder : public TransactionBuilderBase<EscrowCancelBuilder>
|
||||
{
|
||||
public:
|
||||
EscrowCancelBuilder(SF_ACCOUNT::type::value_type account,
|
||||
std::decay_t<typename SF_ACCOUNT::type::value_type> const& owner, std::decay_t<typename SF_UINT32::type::value_type> const& offerSequence, std::optional<SF_UINT32::type::value_type> sequence = std::nullopt,
|
||||
std::optional<SF_AMOUNT::type::value_type> fee = std::nullopt
|
||||
)
|
||||
: TransactionBuilderBase<EscrowCancelBuilder>(ttESCROW_CANCEL, account, sequence, fee)
|
||||
{
|
||||
setOwner(owner);
|
||||
setOfferSequence(offerSequence);
|
||||
}
|
||||
|
||||
EscrowCancelBuilder(STTx const& tx)
|
||||
{
|
||||
if (tx.getTxnType() != ttESCROW_CANCEL)
|
||||
{
|
||||
throw std::runtime_error("Invalid transaction type for EscrowCancelBuilder");
|
||||
}
|
||||
object_ = tx;
|
||||
}
|
||||
|
||||
// Transaction-specific field setters
|
||||
|
||||
/**
|
||||
* Set sfOwner (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
EscrowCancelBuilder&
|
||||
setOwner(std::decay_t<typename SF_ACCOUNT::type::value_type> const& value)
|
||||
{
|
||||
object_[sfOwner] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfOfferSequence (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
EscrowCancelBuilder&
|
||||
setOfferSequence(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfOfferSequence] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build and return the completed EscrowCancel wrapper.
|
||||
* @return The constructed transaction wrapper.
|
||||
* @throws std::runtime_error if the JSON cannot be parsed into a valid transaction.
|
||||
*/
|
||||
EscrowCancel
|
||||
build()
|
||||
{
|
||||
return EscrowCancel(STTx(std::move(object_)));
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::transactions
|
||||
@@ -1,264 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STTx.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/TransactionBase.h>
|
||||
#include <xrpl/protocol_autogen/TransactionBuilderBase.h>
|
||||
#include <xrpl/json/json_value.h>
|
||||
|
||||
#include <stdexcept>
|
||||
#include <optional>
|
||||
|
||||
namespace xrpl::transactions {
|
||||
|
||||
// Forward declaration
|
||||
class EscrowCreateBuilder;
|
||||
|
||||
/**
|
||||
* Transaction: EscrowCreate
|
||||
* Type: ttESCROW_CREATE (1)
|
||||
* Delegable: Delegation::delegable
|
||||
* Amendment: uint256{}
|
||||
* Privileges: noPriv
|
||||
*
|
||||
* Immutable wrapper around STTx providing type-safe field access.
|
||||
* Use EscrowCreateBuilder to construct new transactions.
|
||||
*/
|
||||
class EscrowCreate : public TransactionBase
|
||||
{
|
||||
public:
|
||||
static constexpr xrpl::TxType txType = ttESCROW_CREATE;
|
||||
|
||||
/**
|
||||
* Construct a EscrowCreate transaction wrapper from an existing STTx object.
|
||||
* @throws std::runtime_error if the transaction type doesn't match.
|
||||
*/
|
||||
explicit EscrowCreate(STTx const& tx)
|
||||
: TransactionBase(tx)
|
||||
{
|
||||
// Verify transaction type
|
||||
if (tx.getTxnType() != txType)
|
||||
{
|
||||
throw std::runtime_error("Invalid transaction type for EscrowCreate");
|
||||
}
|
||||
}
|
||||
|
||||
// Transaction-specific field getters
|
||||
|
||||
/**
|
||||
* Get sfDestination (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_ACCOUNT::type::value_type
|
||||
getDestination() const
|
||||
{
|
||||
return this->tx_.at(sfDestination);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfAmount (soeREQUIRED)
|
||||
* Note: This field supports MPT (Multi-Purpose Token) amounts.
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_AMOUNT::type::value_type
|
||||
getAmount() const
|
||||
{
|
||||
return this->tx_.at(sfAmount);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfCondition (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_VL::type::value_type>
|
||||
getCondition() const
|
||||
{
|
||||
if (hasCondition())
|
||||
{
|
||||
return this->tx_.at(sfCondition);
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasCondition() const
|
||||
{
|
||||
return this->tx_.isFieldPresent(sfCondition);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfCancelAfter (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT32::type::value_type>
|
||||
getCancelAfter() const
|
||||
{
|
||||
if (hasCancelAfter())
|
||||
{
|
||||
return this->tx_.at(sfCancelAfter);
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasCancelAfter() const
|
||||
{
|
||||
return this->tx_.isFieldPresent(sfCancelAfter);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfFinishAfter (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT32::type::value_type>
|
||||
getFinishAfter() const
|
||||
{
|
||||
if (hasFinishAfter())
|
||||
{
|
||||
return this->tx_.at(sfFinishAfter);
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasFinishAfter() const
|
||||
{
|
||||
return this->tx_.isFieldPresent(sfFinishAfter);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfDestinationTag (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT32::type::value_type>
|
||||
getDestinationTag() const
|
||||
{
|
||||
if (hasDestinationTag())
|
||||
{
|
||||
return this->tx_.at(sfDestinationTag);
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasDestinationTag() const
|
||||
{
|
||||
return this->tx_.isFieldPresent(sfDestinationTag);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Builder for EscrowCreate transactions.
|
||||
* Provides a fluent interface for constructing transactions with method chaining.
|
||||
* Uses Json::Value internally for flexible transaction construction.
|
||||
* Inherits common field setters from TransactionBuilderBase.
|
||||
*/
|
||||
class EscrowCreateBuilder : public TransactionBuilderBase<EscrowCreateBuilder>
|
||||
{
|
||||
public:
|
||||
EscrowCreateBuilder(SF_ACCOUNT::type::value_type account,
|
||||
std::decay_t<typename SF_ACCOUNT::type::value_type> const& destination, std::decay_t<typename SF_AMOUNT::type::value_type> const& amount, std::optional<SF_UINT32::type::value_type> sequence = std::nullopt,
|
||||
std::optional<SF_AMOUNT::type::value_type> fee = std::nullopt
|
||||
)
|
||||
: TransactionBuilderBase<EscrowCreateBuilder>(ttESCROW_CREATE, account, sequence, fee)
|
||||
{
|
||||
setDestination(destination);
|
||||
setAmount(amount);
|
||||
}
|
||||
|
||||
EscrowCreateBuilder(STTx const& tx)
|
||||
{
|
||||
if (tx.getTxnType() != ttESCROW_CREATE)
|
||||
{
|
||||
throw std::runtime_error("Invalid transaction type for EscrowCreateBuilder");
|
||||
}
|
||||
object_ = tx;
|
||||
}
|
||||
|
||||
// Transaction-specific field setters
|
||||
|
||||
/**
|
||||
* Set sfDestination (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
EscrowCreateBuilder&
|
||||
setDestination(std::decay_t<typename SF_ACCOUNT::type::value_type> const& value)
|
||||
{
|
||||
object_[sfDestination] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfAmount (soeREQUIRED)
|
||||
* Note: This field supports MPT (Multi-Purpose Token) amounts.
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
EscrowCreateBuilder&
|
||||
setAmount(std::decay_t<typename SF_AMOUNT::type::value_type> const& value)
|
||||
{
|
||||
object_[sfAmount] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfCondition (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
EscrowCreateBuilder&
|
||||
setCondition(std::decay_t<typename SF_VL::type::value_type> const& value)
|
||||
{
|
||||
object_[sfCondition] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfCancelAfter (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
EscrowCreateBuilder&
|
||||
setCancelAfter(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfCancelAfter] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfFinishAfter (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
EscrowCreateBuilder&
|
||||
setFinishAfter(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfFinishAfter] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfDestinationTag (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
EscrowCreateBuilder&
|
||||
setDestinationTag(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfDestinationTag] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build and return the completed EscrowCreate wrapper.
|
||||
* @return The constructed transaction wrapper.
|
||||
* @throws std::runtime_error if the JSON cannot be parsed into a valid transaction.
|
||||
*/
|
||||
EscrowCreate
|
||||
build()
|
||||
{
|
||||
return EscrowCreate(STTx(std::move(object_)));
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::transactions
|
||||
@@ -1,230 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STTx.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/TransactionBase.h>
|
||||
#include <xrpl/protocol_autogen/TransactionBuilderBase.h>
|
||||
#include <xrpl/json/json_value.h>
|
||||
|
||||
#include <stdexcept>
|
||||
#include <optional>
|
||||
|
||||
namespace xrpl::transactions {
|
||||
|
||||
// Forward declaration
|
||||
class EscrowFinishBuilder;
|
||||
|
||||
/**
|
||||
* Transaction: EscrowFinish
|
||||
* Type: ttESCROW_FINISH (2)
|
||||
* Delegable: Delegation::delegable
|
||||
* Amendment: uint256{}
|
||||
* Privileges: noPriv
|
||||
*
|
||||
* Immutable wrapper around STTx providing type-safe field access.
|
||||
* Use EscrowFinishBuilder to construct new transactions.
|
||||
*/
|
||||
class EscrowFinish : public TransactionBase
|
||||
{
|
||||
public:
|
||||
static constexpr xrpl::TxType txType = ttESCROW_FINISH;
|
||||
|
||||
/**
|
||||
* Construct a EscrowFinish transaction wrapper from an existing STTx object.
|
||||
* @throws std::runtime_error if the transaction type doesn't match.
|
||||
*/
|
||||
explicit EscrowFinish(STTx const& tx)
|
||||
: TransactionBase(tx)
|
||||
{
|
||||
// Verify transaction type
|
||||
if (tx.getTxnType() != txType)
|
||||
{
|
||||
throw std::runtime_error("Invalid transaction type for EscrowFinish");
|
||||
}
|
||||
}
|
||||
|
||||
// Transaction-specific field getters
|
||||
|
||||
/**
|
||||
* Get sfOwner (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_ACCOUNT::type::value_type
|
||||
getOwner() const
|
||||
{
|
||||
return this->tx_.at(sfOwner);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfOfferSequence (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT32::type::value_type
|
||||
getOfferSequence() const
|
||||
{
|
||||
return this->tx_.at(sfOfferSequence);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfFulfillment (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_VL::type::value_type>
|
||||
getFulfillment() const
|
||||
{
|
||||
if (hasFulfillment())
|
||||
{
|
||||
return this->tx_.at(sfFulfillment);
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasFulfillment() const
|
||||
{
|
||||
return this->tx_.isFieldPresent(sfFulfillment);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfCondition (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_VL::type::value_type>
|
||||
getCondition() const
|
||||
{
|
||||
if (hasCondition())
|
||||
{
|
||||
return this->tx_.at(sfCondition);
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasCondition() const
|
||||
{
|
||||
return this->tx_.isFieldPresent(sfCondition);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfCredentialIDs (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_VECTOR256::type::value_type>
|
||||
getCredentialIDs() const
|
||||
{
|
||||
if (hasCredentialIDs())
|
||||
{
|
||||
return this->tx_.at(sfCredentialIDs);
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasCredentialIDs() const
|
||||
{
|
||||
return this->tx_.isFieldPresent(sfCredentialIDs);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Builder for EscrowFinish transactions.
|
||||
* Provides a fluent interface for constructing transactions with method chaining.
|
||||
* Uses Json::Value internally for flexible transaction construction.
|
||||
* Inherits common field setters from TransactionBuilderBase.
|
||||
*/
|
||||
class EscrowFinishBuilder : public TransactionBuilderBase<EscrowFinishBuilder>
|
||||
{
|
||||
public:
|
||||
EscrowFinishBuilder(SF_ACCOUNT::type::value_type account,
|
||||
std::decay_t<typename SF_ACCOUNT::type::value_type> const& owner, std::decay_t<typename SF_UINT32::type::value_type> const& offerSequence, std::optional<SF_UINT32::type::value_type> sequence = std::nullopt,
|
||||
std::optional<SF_AMOUNT::type::value_type> fee = std::nullopt
|
||||
)
|
||||
: TransactionBuilderBase<EscrowFinishBuilder>(ttESCROW_FINISH, account, sequence, fee)
|
||||
{
|
||||
setOwner(owner);
|
||||
setOfferSequence(offerSequence);
|
||||
}
|
||||
|
||||
EscrowFinishBuilder(STTx const& tx)
|
||||
{
|
||||
if (tx.getTxnType() != ttESCROW_FINISH)
|
||||
{
|
||||
throw std::runtime_error("Invalid transaction type for EscrowFinishBuilder");
|
||||
}
|
||||
object_ = tx;
|
||||
}
|
||||
|
||||
// Transaction-specific field setters
|
||||
|
||||
/**
|
||||
* Set sfOwner (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
EscrowFinishBuilder&
|
||||
setOwner(std::decay_t<typename SF_ACCOUNT::type::value_type> const& value)
|
||||
{
|
||||
object_[sfOwner] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfOfferSequence (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
EscrowFinishBuilder&
|
||||
setOfferSequence(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfOfferSequence] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfFulfillment (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
EscrowFinishBuilder&
|
||||
setFulfillment(std::decay_t<typename SF_VL::type::value_type> const& value)
|
||||
{
|
||||
object_[sfFulfillment] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfCondition (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
EscrowFinishBuilder&
|
||||
setCondition(std::decay_t<typename SF_VL::type::value_type> const& value)
|
||||
{
|
||||
object_[sfCondition] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfCredentialIDs (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
EscrowFinishBuilder&
|
||||
setCredentialIDs(std::decay_t<typename SF_VECTOR256::type::value_type> const& value)
|
||||
{
|
||||
object_[sfCredentialIDs] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build and return the completed EscrowFinish wrapper.
|
||||
* @return The constructed transaction wrapper.
|
||||
* @throws std::runtime_error if the JSON cannot be parsed into a valid transaction.
|
||||
*/
|
||||
EscrowFinish
|
||||
build()
|
||||
{
|
||||
return EscrowFinish(STTx(std::move(object_)));
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::transactions
|
||||
@@ -1,144 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STTx.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/TransactionBase.h>
|
||||
#include <xrpl/protocol_autogen/TransactionBuilderBase.h>
|
||||
#include <xrpl/json/json_value.h>
|
||||
|
||||
#include <stdexcept>
|
||||
#include <optional>
|
||||
|
||||
namespace xrpl::transactions {
|
||||
|
||||
// Forward declaration
|
||||
class LedgerStateFixBuilder;
|
||||
|
||||
/**
|
||||
* Transaction: LedgerStateFix
|
||||
* Type: ttLEDGER_STATE_FIX (53)
|
||||
* Delegable: Delegation::delegable
|
||||
* Amendment: fixNFTokenPageLinks
|
||||
* Privileges: noPriv
|
||||
*
|
||||
* Immutable wrapper around STTx providing type-safe field access.
|
||||
* Use LedgerStateFixBuilder to construct new transactions.
|
||||
*/
|
||||
class LedgerStateFix : public TransactionBase
|
||||
{
|
||||
public:
|
||||
static constexpr xrpl::TxType txType = ttLEDGER_STATE_FIX;
|
||||
|
||||
/**
|
||||
* Construct a LedgerStateFix transaction wrapper from an existing STTx object.
|
||||
* @throws std::runtime_error if the transaction type doesn't match.
|
||||
*/
|
||||
explicit LedgerStateFix(STTx const& tx)
|
||||
: TransactionBase(tx)
|
||||
{
|
||||
// Verify transaction type
|
||||
if (tx.getTxnType() != txType)
|
||||
{
|
||||
throw std::runtime_error("Invalid transaction type for LedgerStateFix");
|
||||
}
|
||||
}
|
||||
|
||||
// Transaction-specific field getters
|
||||
|
||||
/**
|
||||
* Get sfLedgerFixType (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT16::type::value_type
|
||||
getLedgerFixType() const
|
||||
{
|
||||
return this->tx_.at(sfLedgerFixType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfOwner (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_ACCOUNT::type::value_type>
|
||||
getOwner() const
|
||||
{
|
||||
if (hasOwner())
|
||||
{
|
||||
return this->tx_.at(sfOwner);
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasOwner() const
|
||||
{
|
||||
return this->tx_.isFieldPresent(sfOwner);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Builder for LedgerStateFix transactions.
|
||||
* Provides a fluent interface for constructing transactions with method chaining.
|
||||
* Uses Json::Value internally for flexible transaction construction.
|
||||
* Inherits common field setters from TransactionBuilderBase.
|
||||
*/
|
||||
class LedgerStateFixBuilder : public TransactionBuilderBase<LedgerStateFixBuilder>
|
||||
{
|
||||
public:
|
||||
LedgerStateFixBuilder(SF_ACCOUNT::type::value_type account,
|
||||
std::decay_t<typename SF_UINT16::type::value_type> const& ledgerFixType, std::optional<SF_UINT32::type::value_type> sequence = std::nullopt,
|
||||
std::optional<SF_AMOUNT::type::value_type> fee = std::nullopt
|
||||
)
|
||||
: TransactionBuilderBase<LedgerStateFixBuilder>(ttLEDGER_STATE_FIX, account, sequence, fee)
|
||||
{
|
||||
setLedgerFixType(ledgerFixType);
|
||||
}
|
||||
|
||||
LedgerStateFixBuilder(STTx const& tx)
|
||||
{
|
||||
if (tx.getTxnType() != ttLEDGER_STATE_FIX)
|
||||
{
|
||||
throw std::runtime_error("Invalid transaction type for LedgerStateFixBuilder");
|
||||
}
|
||||
object_ = tx;
|
||||
}
|
||||
|
||||
// Transaction-specific field setters
|
||||
|
||||
/**
|
||||
* Set sfLedgerFixType (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
LedgerStateFixBuilder&
|
||||
setLedgerFixType(std::decay_t<typename SF_UINT16::type::value_type> const& value)
|
||||
{
|
||||
object_[sfLedgerFixType] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfOwner (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
LedgerStateFixBuilder&
|
||||
setOwner(std::decay_t<typename SF_ACCOUNT::type::value_type> const& value)
|
||||
{
|
||||
object_[sfOwner] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build and return the completed LedgerStateFix wrapper.
|
||||
* @return The constructed transaction wrapper.
|
||||
* @throws std::runtime_error if the JSON cannot be parsed into a valid transaction.
|
||||
*/
|
||||
LedgerStateFix
|
||||
build()
|
||||
{
|
||||
return LedgerStateFix(STTx(std::move(object_)));
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::transactions
|
||||
@@ -1,156 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STTx.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/TransactionBase.h>
|
||||
#include <xrpl/protocol_autogen/TransactionBuilderBase.h>
|
||||
#include <xrpl/json/json_value.h>
|
||||
|
||||
#include <stdexcept>
|
||||
#include <optional>
|
||||
|
||||
namespace xrpl::transactions {
|
||||
|
||||
// Forward declaration
|
||||
class LoanBrokerCoverClawbackBuilder;
|
||||
|
||||
/**
|
||||
* Transaction: LoanBrokerCoverClawback
|
||||
* Type: ttLOAN_BROKER_COVER_CLAWBACK (78)
|
||||
* Delegable: Delegation::delegable
|
||||
* Amendment: featureLendingProtocol
|
||||
* Privileges: noPriv
|
||||
*
|
||||
* Immutable wrapper around STTx providing type-safe field access.
|
||||
* Use LoanBrokerCoverClawbackBuilder to construct new transactions.
|
||||
*/
|
||||
class LoanBrokerCoverClawback : public TransactionBase
|
||||
{
|
||||
public:
|
||||
static constexpr xrpl::TxType txType = ttLOAN_BROKER_COVER_CLAWBACK;
|
||||
|
||||
/**
|
||||
* Construct a LoanBrokerCoverClawback transaction wrapper from an existing STTx object.
|
||||
* @throws std::runtime_error if the transaction type doesn't match.
|
||||
*/
|
||||
explicit LoanBrokerCoverClawback(STTx const& tx)
|
||||
: TransactionBase(tx)
|
||||
{
|
||||
// Verify transaction type
|
||||
if (tx.getTxnType() != txType)
|
||||
{
|
||||
throw std::runtime_error("Invalid transaction type for LoanBrokerCoverClawback");
|
||||
}
|
||||
}
|
||||
|
||||
// Transaction-specific field getters
|
||||
|
||||
/**
|
||||
* Get sfLoanBrokerID (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT256::type::value_type>
|
||||
getLoanBrokerID() const
|
||||
{
|
||||
if (hasLoanBrokerID())
|
||||
{
|
||||
return this->tx_.at(sfLoanBrokerID);
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasLoanBrokerID() const
|
||||
{
|
||||
return this->tx_.isFieldPresent(sfLoanBrokerID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfAmount (soeOPTIONAL)
|
||||
* Note: This field supports MPT (Multi-Purpose Token) amounts.
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_AMOUNT::type::value_type>
|
||||
getAmount() const
|
||||
{
|
||||
if (hasAmount())
|
||||
{
|
||||
return this->tx_.at(sfAmount);
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasAmount() const
|
||||
{
|
||||
return this->tx_.isFieldPresent(sfAmount);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Builder for LoanBrokerCoverClawback transactions.
|
||||
* Provides a fluent interface for constructing transactions with method chaining.
|
||||
* Uses Json::Value internally for flexible transaction construction.
|
||||
* Inherits common field setters from TransactionBuilderBase.
|
||||
*/
|
||||
class LoanBrokerCoverClawbackBuilder : public TransactionBuilderBase<LoanBrokerCoverClawbackBuilder>
|
||||
{
|
||||
public:
|
||||
LoanBrokerCoverClawbackBuilder(SF_ACCOUNT::type::value_type account,
|
||||
std::optional<SF_UINT32::type::value_type> sequence = std::nullopt,
|
||||
std::optional<SF_AMOUNT::type::value_type> fee = std::nullopt
|
||||
)
|
||||
: TransactionBuilderBase<LoanBrokerCoverClawbackBuilder>(ttLOAN_BROKER_COVER_CLAWBACK, account, sequence, fee)
|
||||
{
|
||||
}
|
||||
|
||||
LoanBrokerCoverClawbackBuilder(STTx const& tx)
|
||||
{
|
||||
if (tx.getTxnType() != ttLOAN_BROKER_COVER_CLAWBACK)
|
||||
{
|
||||
throw std::runtime_error("Invalid transaction type for LoanBrokerCoverClawbackBuilder");
|
||||
}
|
||||
object_ = tx;
|
||||
}
|
||||
|
||||
// Transaction-specific field setters
|
||||
|
||||
/**
|
||||
* Set sfLoanBrokerID (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
LoanBrokerCoverClawbackBuilder&
|
||||
setLoanBrokerID(std::decay_t<typename SF_UINT256::type::value_type> const& value)
|
||||
{
|
||||
object_[sfLoanBrokerID] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfAmount (soeOPTIONAL)
|
||||
* Note: This field supports MPT (Multi-Purpose Token) amounts.
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
LoanBrokerCoverClawbackBuilder&
|
||||
setAmount(std::decay_t<typename SF_AMOUNT::type::value_type> const& value)
|
||||
{
|
||||
object_[sfAmount] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build and return the completed LoanBrokerCoverClawback wrapper.
|
||||
* @return The constructed transaction wrapper.
|
||||
* @throws std::runtime_error if the JSON cannot be parsed into a valid transaction.
|
||||
*/
|
||||
LoanBrokerCoverClawback
|
||||
build()
|
||||
{
|
||||
return LoanBrokerCoverClawback(STTx(std::move(object_)));
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::transactions
|
||||
@@ -1,136 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STTx.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/TransactionBase.h>
|
||||
#include <xrpl/protocol_autogen/TransactionBuilderBase.h>
|
||||
#include <xrpl/json/json_value.h>
|
||||
|
||||
#include <stdexcept>
|
||||
#include <optional>
|
||||
|
||||
namespace xrpl::transactions {
|
||||
|
||||
// Forward declaration
|
||||
class LoanBrokerCoverDepositBuilder;
|
||||
|
||||
/**
|
||||
* Transaction: LoanBrokerCoverDeposit
|
||||
* Type: ttLOAN_BROKER_COVER_DEPOSIT (76)
|
||||
* Delegable: Delegation::delegable
|
||||
* Amendment: featureLendingProtocol
|
||||
* Privileges: noPriv
|
||||
*
|
||||
* Immutable wrapper around STTx providing type-safe field access.
|
||||
* Use LoanBrokerCoverDepositBuilder to construct new transactions.
|
||||
*/
|
||||
class LoanBrokerCoverDeposit : public TransactionBase
|
||||
{
|
||||
public:
|
||||
static constexpr xrpl::TxType txType = ttLOAN_BROKER_COVER_DEPOSIT;
|
||||
|
||||
/**
|
||||
* Construct a LoanBrokerCoverDeposit transaction wrapper from an existing STTx object.
|
||||
* @throws std::runtime_error if the transaction type doesn't match.
|
||||
*/
|
||||
explicit LoanBrokerCoverDeposit(STTx const& tx)
|
||||
: TransactionBase(tx)
|
||||
{
|
||||
// Verify transaction type
|
||||
if (tx.getTxnType() != txType)
|
||||
{
|
||||
throw std::runtime_error("Invalid transaction type for LoanBrokerCoverDeposit");
|
||||
}
|
||||
}
|
||||
|
||||
// Transaction-specific field getters
|
||||
|
||||
/**
|
||||
* Get sfLoanBrokerID (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT256::type::value_type
|
||||
getLoanBrokerID() const
|
||||
{
|
||||
return this->tx_.at(sfLoanBrokerID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfAmount (soeREQUIRED)
|
||||
* Note: This field supports MPT (Multi-Purpose Token) amounts.
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_AMOUNT::type::value_type
|
||||
getAmount() const
|
||||
{
|
||||
return this->tx_.at(sfAmount);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Builder for LoanBrokerCoverDeposit transactions.
|
||||
* Provides a fluent interface for constructing transactions with method chaining.
|
||||
* Uses Json::Value internally for flexible transaction construction.
|
||||
* Inherits common field setters from TransactionBuilderBase.
|
||||
*/
|
||||
class LoanBrokerCoverDepositBuilder : public TransactionBuilderBase<LoanBrokerCoverDepositBuilder>
|
||||
{
|
||||
public:
|
||||
LoanBrokerCoverDepositBuilder(SF_ACCOUNT::type::value_type account,
|
||||
std::decay_t<typename SF_UINT256::type::value_type> const& loanBrokerID, std::decay_t<typename SF_AMOUNT::type::value_type> const& amount, std::optional<SF_UINT32::type::value_type> sequence = std::nullopt,
|
||||
std::optional<SF_AMOUNT::type::value_type> fee = std::nullopt
|
||||
)
|
||||
: TransactionBuilderBase<LoanBrokerCoverDepositBuilder>(ttLOAN_BROKER_COVER_DEPOSIT, account, sequence, fee)
|
||||
{
|
||||
setLoanBrokerID(loanBrokerID);
|
||||
setAmount(amount);
|
||||
}
|
||||
|
||||
LoanBrokerCoverDepositBuilder(STTx const& tx)
|
||||
{
|
||||
if (tx.getTxnType() != ttLOAN_BROKER_COVER_DEPOSIT)
|
||||
{
|
||||
throw std::runtime_error("Invalid transaction type for LoanBrokerCoverDepositBuilder");
|
||||
}
|
||||
object_ = tx;
|
||||
}
|
||||
|
||||
// Transaction-specific field setters
|
||||
|
||||
/**
|
||||
* Set sfLoanBrokerID (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
LoanBrokerCoverDepositBuilder&
|
||||
setLoanBrokerID(std::decay_t<typename SF_UINT256::type::value_type> const& value)
|
||||
{
|
||||
object_[sfLoanBrokerID] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfAmount (soeREQUIRED)
|
||||
* Note: This field supports MPT (Multi-Purpose Token) amounts.
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
LoanBrokerCoverDepositBuilder&
|
||||
setAmount(std::decay_t<typename SF_AMOUNT::type::value_type> const& value)
|
||||
{
|
||||
object_[sfAmount] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build and return the completed LoanBrokerCoverDeposit wrapper.
|
||||
* @return The constructed transaction wrapper.
|
||||
* @throws std::runtime_error if the JSON cannot be parsed into a valid transaction.
|
||||
*/
|
||||
LoanBrokerCoverDeposit
|
||||
build()
|
||||
{
|
||||
return LoanBrokerCoverDeposit(STTx(std::move(object_)));
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::transactions
|
||||
@@ -1,200 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STTx.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/TransactionBase.h>
|
||||
#include <xrpl/protocol_autogen/TransactionBuilderBase.h>
|
||||
#include <xrpl/json/json_value.h>
|
||||
|
||||
#include <stdexcept>
|
||||
#include <optional>
|
||||
|
||||
namespace xrpl::transactions {
|
||||
|
||||
// Forward declaration
|
||||
class LoanBrokerCoverWithdrawBuilder;
|
||||
|
||||
/**
|
||||
* Transaction: LoanBrokerCoverWithdraw
|
||||
* Type: ttLOAN_BROKER_COVER_WITHDRAW (77)
|
||||
* Delegable: Delegation::delegable
|
||||
* Amendment: featureLendingProtocol
|
||||
* Privileges: mayAuthorizeMPT
|
||||
*
|
||||
* Immutable wrapper around STTx providing type-safe field access.
|
||||
* Use LoanBrokerCoverWithdrawBuilder to construct new transactions.
|
||||
*/
|
||||
class LoanBrokerCoverWithdraw : public TransactionBase
|
||||
{
|
||||
public:
|
||||
static constexpr xrpl::TxType txType = ttLOAN_BROKER_COVER_WITHDRAW;
|
||||
|
||||
/**
|
||||
* Construct a LoanBrokerCoverWithdraw transaction wrapper from an existing STTx object.
|
||||
* @throws std::runtime_error if the transaction type doesn't match.
|
||||
*/
|
||||
explicit LoanBrokerCoverWithdraw(STTx const& tx)
|
||||
: TransactionBase(tx)
|
||||
{
|
||||
// Verify transaction type
|
||||
if (tx.getTxnType() != txType)
|
||||
{
|
||||
throw std::runtime_error("Invalid transaction type for LoanBrokerCoverWithdraw");
|
||||
}
|
||||
}
|
||||
|
||||
// Transaction-specific field getters
|
||||
|
||||
/**
|
||||
* Get sfLoanBrokerID (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT256::type::value_type
|
||||
getLoanBrokerID() const
|
||||
{
|
||||
return this->tx_.at(sfLoanBrokerID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfAmount (soeREQUIRED)
|
||||
* Note: This field supports MPT (Multi-Purpose Token) amounts.
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_AMOUNT::type::value_type
|
||||
getAmount() const
|
||||
{
|
||||
return this->tx_.at(sfAmount);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfDestination (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_ACCOUNT::type::value_type>
|
||||
getDestination() const
|
||||
{
|
||||
if (hasDestination())
|
||||
{
|
||||
return this->tx_.at(sfDestination);
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasDestination() const
|
||||
{
|
||||
return this->tx_.isFieldPresent(sfDestination);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfDestinationTag (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT32::type::value_type>
|
||||
getDestinationTag() const
|
||||
{
|
||||
if (hasDestinationTag())
|
||||
{
|
||||
return this->tx_.at(sfDestinationTag);
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasDestinationTag() const
|
||||
{
|
||||
return this->tx_.isFieldPresent(sfDestinationTag);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Builder for LoanBrokerCoverWithdraw transactions.
|
||||
* Provides a fluent interface for constructing transactions with method chaining.
|
||||
* Uses Json::Value internally for flexible transaction construction.
|
||||
* Inherits common field setters from TransactionBuilderBase.
|
||||
*/
|
||||
class LoanBrokerCoverWithdrawBuilder : public TransactionBuilderBase<LoanBrokerCoverWithdrawBuilder>
|
||||
{
|
||||
public:
|
||||
LoanBrokerCoverWithdrawBuilder(SF_ACCOUNT::type::value_type account,
|
||||
std::decay_t<typename SF_UINT256::type::value_type> const& loanBrokerID, std::decay_t<typename SF_AMOUNT::type::value_type> const& amount, std::optional<SF_UINT32::type::value_type> sequence = std::nullopt,
|
||||
std::optional<SF_AMOUNT::type::value_type> fee = std::nullopt
|
||||
)
|
||||
: TransactionBuilderBase<LoanBrokerCoverWithdrawBuilder>(ttLOAN_BROKER_COVER_WITHDRAW, account, sequence, fee)
|
||||
{
|
||||
setLoanBrokerID(loanBrokerID);
|
||||
setAmount(amount);
|
||||
}
|
||||
|
||||
LoanBrokerCoverWithdrawBuilder(STTx const& tx)
|
||||
{
|
||||
if (tx.getTxnType() != ttLOAN_BROKER_COVER_WITHDRAW)
|
||||
{
|
||||
throw std::runtime_error("Invalid transaction type for LoanBrokerCoverWithdrawBuilder");
|
||||
}
|
||||
object_ = tx;
|
||||
}
|
||||
|
||||
// Transaction-specific field setters
|
||||
|
||||
/**
|
||||
* Set sfLoanBrokerID (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
LoanBrokerCoverWithdrawBuilder&
|
||||
setLoanBrokerID(std::decay_t<typename SF_UINT256::type::value_type> const& value)
|
||||
{
|
||||
object_[sfLoanBrokerID] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfAmount (soeREQUIRED)
|
||||
* Note: This field supports MPT (Multi-Purpose Token) amounts.
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
LoanBrokerCoverWithdrawBuilder&
|
||||
setAmount(std::decay_t<typename SF_AMOUNT::type::value_type> const& value)
|
||||
{
|
||||
object_[sfAmount] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfDestination (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
LoanBrokerCoverWithdrawBuilder&
|
||||
setDestination(std::decay_t<typename SF_ACCOUNT::type::value_type> const& value)
|
||||
{
|
||||
object_[sfDestination] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfDestinationTag (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
LoanBrokerCoverWithdrawBuilder&
|
||||
setDestinationTag(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfDestinationTag] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build and return the completed LoanBrokerCoverWithdraw wrapper.
|
||||
* @return The constructed transaction wrapper.
|
||||
* @throws std::runtime_error if the JSON cannot be parsed into a valid transaction.
|
||||
*/
|
||||
LoanBrokerCoverWithdraw
|
||||
build()
|
||||
{
|
||||
return LoanBrokerCoverWithdraw(STTx(std::move(object_)));
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::transactions
|
||||
@@ -1,112 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STTx.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/TransactionBase.h>
|
||||
#include <xrpl/protocol_autogen/TransactionBuilderBase.h>
|
||||
#include <xrpl/json/json_value.h>
|
||||
|
||||
#include <stdexcept>
|
||||
#include <optional>
|
||||
|
||||
namespace xrpl::transactions {
|
||||
|
||||
// Forward declaration
|
||||
class LoanBrokerDeleteBuilder;
|
||||
|
||||
/**
|
||||
* Transaction: LoanBrokerDelete
|
||||
* Type: ttLOAN_BROKER_DELETE (75)
|
||||
* Delegable: Delegation::delegable
|
||||
* Amendment: featureLendingProtocol
|
||||
* Privileges: mustDeleteAcct | mayAuthorizeMPT
|
||||
*
|
||||
* Immutable wrapper around STTx providing type-safe field access.
|
||||
* Use LoanBrokerDeleteBuilder to construct new transactions.
|
||||
*/
|
||||
class LoanBrokerDelete : public TransactionBase
|
||||
{
|
||||
public:
|
||||
static constexpr xrpl::TxType txType = ttLOAN_BROKER_DELETE;
|
||||
|
||||
/**
|
||||
* Construct a LoanBrokerDelete transaction wrapper from an existing STTx object.
|
||||
* @throws std::runtime_error if the transaction type doesn't match.
|
||||
*/
|
||||
explicit LoanBrokerDelete(STTx const& tx)
|
||||
: TransactionBase(tx)
|
||||
{
|
||||
// Verify transaction type
|
||||
if (tx.getTxnType() != txType)
|
||||
{
|
||||
throw std::runtime_error("Invalid transaction type for LoanBrokerDelete");
|
||||
}
|
||||
}
|
||||
|
||||
// Transaction-specific field getters
|
||||
|
||||
/**
|
||||
* Get sfLoanBrokerID (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT256::type::value_type
|
||||
getLoanBrokerID() const
|
||||
{
|
||||
return this->tx_.at(sfLoanBrokerID);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Builder for LoanBrokerDelete transactions.
|
||||
* Provides a fluent interface for constructing transactions with method chaining.
|
||||
* Uses Json::Value internally for flexible transaction construction.
|
||||
* Inherits common field setters from TransactionBuilderBase.
|
||||
*/
|
||||
class LoanBrokerDeleteBuilder : public TransactionBuilderBase<LoanBrokerDeleteBuilder>
|
||||
{
|
||||
public:
|
||||
LoanBrokerDeleteBuilder(SF_ACCOUNT::type::value_type account,
|
||||
std::decay_t<typename SF_UINT256::type::value_type> const& loanBrokerID, std::optional<SF_UINT32::type::value_type> sequence = std::nullopt,
|
||||
std::optional<SF_AMOUNT::type::value_type> fee = std::nullopt
|
||||
)
|
||||
: TransactionBuilderBase<LoanBrokerDeleteBuilder>(ttLOAN_BROKER_DELETE, account, sequence, fee)
|
||||
{
|
||||
setLoanBrokerID(loanBrokerID);
|
||||
}
|
||||
|
||||
LoanBrokerDeleteBuilder(STTx const& tx)
|
||||
{
|
||||
if (tx.getTxnType() != ttLOAN_BROKER_DELETE)
|
||||
{
|
||||
throw std::runtime_error("Invalid transaction type for LoanBrokerDeleteBuilder");
|
||||
}
|
||||
object_ = tx;
|
||||
}
|
||||
|
||||
// Transaction-specific field setters
|
||||
|
||||
/**
|
||||
* Set sfLoanBrokerID (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
LoanBrokerDeleteBuilder&
|
||||
setLoanBrokerID(std::decay_t<typename SF_UINT256::type::value_type> const& value)
|
||||
{
|
||||
object_[sfLoanBrokerID] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build and return the completed LoanBrokerDelete wrapper.
|
||||
* @return The constructed transaction wrapper.
|
||||
* @throws std::runtime_error if the JSON cannot be parsed into a valid transaction.
|
||||
*/
|
||||
LoanBrokerDelete
|
||||
build()
|
||||
{
|
||||
return LoanBrokerDelete(STTx(std::move(object_)));
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::transactions
|
||||
@@ -1,304 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STTx.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/TransactionBase.h>
|
||||
#include <xrpl/protocol_autogen/TransactionBuilderBase.h>
|
||||
#include <xrpl/json/json_value.h>
|
||||
|
||||
#include <stdexcept>
|
||||
#include <optional>
|
||||
|
||||
namespace xrpl::transactions {
|
||||
|
||||
// Forward declaration
|
||||
class LoanBrokerSetBuilder;
|
||||
|
||||
/**
|
||||
* Transaction: LoanBrokerSet
|
||||
* Type: ttLOAN_BROKER_SET (74)
|
||||
* Delegable: Delegation::delegable
|
||||
* Amendment: featureLendingProtocol
|
||||
* Privileges: createPseudoAcct | mayAuthorizeMPT
|
||||
*
|
||||
* Immutable wrapper around STTx providing type-safe field access.
|
||||
* Use LoanBrokerSetBuilder to construct new transactions.
|
||||
*/
|
||||
class LoanBrokerSet : public TransactionBase
|
||||
{
|
||||
public:
|
||||
static constexpr xrpl::TxType txType = ttLOAN_BROKER_SET;
|
||||
|
||||
/**
|
||||
* Construct a LoanBrokerSet transaction wrapper from an existing STTx object.
|
||||
* @throws std::runtime_error if the transaction type doesn't match.
|
||||
*/
|
||||
explicit LoanBrokerSet(STTx const& tx)
|
||||
: TransactionBase(tx)
|
||||
{
|
||||
// Verify transaction type
|
||||
if (tx.getTxnType() != txType)
|
||||
{
|
||||
throw std::runtime_error("Invalid transaction type for LoanBrokerSet");
|
||||
}
|
||||
}
|
||||
|
||||
// Transaction-specific field getters
|
||||
|
||||
/**
|
||||
* Get sfVaultID (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT256::type::value_type
|
||||
getVaultID() const
|
||||
{
|
||||
return this->tx_.at(sfVaultID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfLoanBrokerID (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT256::type::value_type>
|
||||
getLoanBrokerID() const
|
||||
{
|
||||
if (hasLoanBrokerID())
|
||||
{
|
||||
return this->tx_.at(sfLoanBrokerID);
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasLoanBrokerID() const
|
||||
{
|
||||
return this->tx_.isFieldPresent(sfLoanBrokerID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfData (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_VL::type::value_type>
|
||||
getData() const
|
||||
{
|
||||
if (hasData())
|
||||
{
|
||||
return this->tx_.at(sfData);
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasData() const
|
||||
{
|
||||
return this->tx_.isFieldPresent(sfData);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfManagementFeeRate (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT16::type::value_type>
|
||||
getManagementFeeRate() const
|
||||
{
|
||||
if (hasManagementFeeRate())
|
||||
{
|
||||
return this->tx_.at(sfManagementFeeRate);
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasManagementFeeRate() const
|
||||
{
|
||||
return this->tx_.isFieldPresent(sfManagementFeeRate);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfDebtMaximum (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_NUMBER::type::value_type>
|
||||
getDebtMaximum() const
|
||||
{
|
||||
if (hasDebtMaximum())
|
||||
{
|
||||
return this->tx_.at(sfDebtMaximum);
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasDebtMaximum() const
|
||||
{
|
||||
return this->tx_.isFieldPresent(sfDebtMaximum);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfCoverRateMinimum (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT32::type::value_type>
|
||||
getCoverRateMinimum() const
|
||||
{
|
||||
if (hasCoverRateMinimum())
|
||||
{
|
||||
return this->tx_.at(sfCoverRateMinimum);
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasCoverRateMinimum() const
|
||||
{
|
||||
return this->tx_.isFieldPresent(sfCoverRateMinimum);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfCoverRateLiquidation (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT32::type::value_type>
|
||||
getCoverRateLiquidation() const
|
||||
{
|
||||
if (hasCoverRateLiquidation())
|
||||
{
|
||||
return this->tx_.at(sfCoverRateLiquidation);
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasCoverRateLiquidation() const
|
||||
{
|
||||
return this->tx_.isFieldPresent(sfCoverRateLiquidation);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Builder for LoanBrokerSet transactions.
|
||||
* Provides a fluent interface for constructing transactions with method chaining.
|
||||
* Uses Json::Value internally for flexible transaction construction.
|
||||
* Inherits common field setters from TransactionBuilderBase.
|
||||
*/
|
||||
class LoanBrokerSetBuilder : public TransactionBuilderBase<LoanBrokerSetBuilder>
|
||||
{
|
||||
public:
|
||||
LoanBrokerSetBuilder(SF_ACCOUNT::type::value_type account,
|
||||
std::decay_t<typename SF_UINT256::type::value_type> const& vaultID, std::optional<SF_UINT32::type::value_type> sequence = std::nullopt,
|
||||
std::optional<SF_AMOUNT::type::value_type> fee = std::nullopt
|
||||
)
|
||||
: TransactionBuilderBase<LoanBrokerSetBuilder>(ttLOAN_BROKER_SET, account, sequence, fee)
|
||||
{
|
||||
setVaultID(vaultID);
|
||||
}
|
||||
|
||||
LoanBrokerSetBuilder(STTx const& tx)
|
||||
{
|
||||
if (tx.getTxnType() != ttLOAN_BROKER_SET)
|
||||
{
|
||||
throw std::runtime_error("Invalid transaction type for LoanBrokerSetBuilder");
|
||||
}
|
||||
object_ = tx;
|
||||
}
|
||||
|
||||
// Transaction-specific field setters
|
||||
|
||||
/**
|
||||
* Set sfVaultID (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
LoanBrokerSetBuilder&
|
||||
setVaultID(std::decay_t<typename SF_UINT256::type::value_type> const& value)
|
||||
{
|
||||
object_[sfVaultID] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfLoanBrokerID (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
LoanBrokerSetBuilder&
|
||||
setLoanBrokerID(std::decay_t<typename SF_UINT256::type::value_type> const& value)
|
||||
{
|
||||
object_[sfLoanBrokerID] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfData (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
LoanBrokerSetBuilder&
|
||||
setData(std::decay_t<typename SF_VL::type::value_type> const& value)
|
||||
{
|
||||
object_[sfData] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfManagementFeeRate (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
LoanBrokerSetBuilder&
|
||||
setManagementFeeRate(std::decay_t<typename SF_UINT16::type::value_type> const& value)
|
||||
{
|
||||
object_[sfManagementFeeRate] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfDebtMaximum (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
LoanBrokerSetBuilder&
|
||||
setDebtMaximum(std::decay_t<typename SF_NUMBER::type::value_type> const& value)
|
||||
{
|
||||
object_[sfDebtMaximum] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfCoverRateMinimum (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
LoanBrokerSetBuilder&
|
||||
setCoverRateMinimum(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfCoverRateMinimum] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfCoverRateLiquidation (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
LoanBrokerSetBuilder&
|
||||
setCoverRateLiquidation(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfCoverRateLiquidation] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build and return the completed LoanBrokerSet wrapper.
|
||||
* @return The constructed transaction wrapper.
|
||||
* @throws std::runtime_error if the JSON cannot be parsed into a valid transaction.
|
||||
*/
|
||||
LoanBrokerSet
|
||||
build()
|
||||
{
|
||||
return LoanBrokerSet(STTx(std::move(object_)));
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::transactions
|
||||
@@ -1,112 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STTx.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/TransactionBase.h>
|
||||
#include <xrpl/protocol_autogen/TransactionBuilderBase.h>
|
||||
#include <xrpl/json/json_value.h>
|
||||
|
||||
#include <stdexcept>
|
||||
#include <optional>
|
||||
|
||||
namespace xrpl::transactions {
|
||||
|
||||
// Forward declaration
|
||||
class LoanDeleteBuilder;
|
||||
|
||||
/**
|
||||
* Transaction: LoanDelete
|
||||
* Type: ttLOAN_DELETE (81)
|
||||
* Delegable: Delegation::delegable
|
||||
* Amendment: featureLendingProtocol
|
||||
* Privileges: noPriv
|
||||
*
|
||||
* Immutable wrapper around STTx providing type-safe field access.
|
||||
* Use LoanDeleteBuilder to construct new transactions.
|
||||
*/
|
||||
class LoanDelete : public TransactionBase
|
||||
{
|
||||
public:
|
||||
static constexpr xrpl::TxType txType = ttLOAN_DELETE;
|
||||
|
||||
/**
|
||||
* Construct a LoanDelete transaction wrapper from an existing STTx object.
|
||||
* @throws std::runtime_error if the transaction type doesn't match.
|
||||
*/
|
||||
explicit LoanDelete(STTx const& tx)
|
||||
: TransactionBase(tx)
|
||||
{
|
||||
// Verify transaction type
|
||||
if (tx.getTxnType() != txType)
|
||||
{
|
||||
throw std::runtime_error("Invalid transaction type for LoanDelete");
|
||||
}
|
||||
}
|
||||
|
||||
// Transaction-specific field getters
|
||||
|
||||
/**
|
||||
* Get sfLoanID (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT256::type::value_type
|
||||
getLoanID() const
|
||||
{
|
||||
return this->tx_.at(sfLoanID);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Builder for LoanDelete transactions.
|
||||
* Provides a fluent interface for constructing transactions with method chaining.
|
||||
* Uses Json::Value internally for flexible transaction construction.
|
||||
* Inherits common field setters from TransactionBuilderBase.
|
||||
*/
|
||||
class LoanDeleteBuilder : public TransactionBuilderBase<LoanDeleteBuilder>
|
||||
{
|
||||
public:
|
||||
LoanDeleteBuilder(SF_ACCOUNT::type::value_type account,
|
||||
std::decay_t<typename SF_UINT256::type::value_type> const& loanID, std::optional<SF_UINT32::type::value_type> sequence = std::nullopt,
|
||||
std::optional<SF_AMOUNT::type::value_type> fee = std::nullopt
|
||||
)
|
||||
: TransactionBuilderBase<LoanDeleteBuilder>(ttLOAN_DELETE, account, sequence, fee)
|
||||
{
|
||||
setLoanID(loanID);
|
||||
}
|
||||
|
||||
LoanDeleteBuilder(STTx const& tx)
|
||||
{
|
||||
if (tx.getTxnType() != ttLOAN_DELETE)
|
||||
{
|
||||
throw std::runtime_error("Invalid transaction type for LoanDeleteBuilder");
|
||||
}
|
||||
object_ = tx;
|
||||
}
|
||||
|
||||
// Transaction-specific field setters
|
||||
|
||||
/**
|
||||
* Set sfLoanID (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
LoanDeleteBuilder&
|
||||
setLoanID(std::decay_t<typename SF_UINT256::type::value_type> const& value)
|
||||
{
|
||||
object_[sfLoanID] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build and return the completed LoanDelete wrapper.
|
||||
* @return The constructed transaction wrapper.
|
||||
* @throws std::runtime_error if the JSON cannot be parsed into a valid transaction.
|
||||
*/
|
||||
LoanDelete
|
||||
build()
|
||||
{
|
||||
return LoanDelete(STTx(std::move(object_)));
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::transactions
|
||||
@@ -1,112 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STTx.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/TransactionBase.h>
|
||||
#include <xrpl/protocol_autogen/TransactionBuilderBase.h>
|
||||
#include <xrpl/json/json_value.h>
|
||||
|
||||
#include <stdexcept>
|
||||
#include <optional>
|
||||
|
||||
namespace xrpl::transactions {
|
||||
|
||||
// Forward declaration
|
||||
class LoanManageBuilder;
|
||||
|
||||
/**
|
||||
* Transaction: LoanManage
|
||||
* Type: ttLOAN_MANAGE (82)
|
||||
* Delegable: Delegation::delegable
|
||||
* Amendment: featureLendingProtocol
|
||||
* Privileges: mayModifyVault
|
||||
*
|
||||
* Immutable wrapper around STTx providing type-safe field access.
|
||||
* Use LoanManageBuilder to construct new transactions.
|
||||
*/
|
||||
class LoanManage : public TransactionBase
|
||||
{
|
||||
public:
|
||||
static constexpr xrpl::TxType txType = ttLOAN_MANAGE;
|
||||
|
||||
/**
|
||||
* Construct a LoanManage transaction wrapper from an existing STTx object.
|
||||
* @throws std::runtime_error if the transaction type doesn't match.
|
||||
*/
|
||||
explicit LoanManage(STTx const& tx)
|
||||
: TransactionBase(tx)
|
||||
{
|
||||
// Verify transaction type
|
||||
if (tx.getTxnType() != txType)
|
||||
{
|
||||
throw std::runtime_error("Invalid transaction type for LoanManage");
|
||||
}
|
||||
}
|
||||
|
||||
// Transaction-specific field getters
|
||||
|
||||
/**
|
||||
* Get sfLoanID (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT256::type::value_type
|
||||
getLoanID() const
|
||||
{
|
||||
return this->tx_.at(sfLoanID);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Builder for LoanManage transactions.
|
||||
* Provides a fluent interface for constructing transactions with method chaining.
|
||||
* Uses Json::Value internally for flexible transaction construction.
|
||||
* Inherits common field setters from TransactionBuilderBase.
|
||||
*/
|
||||
class LoanManageBuilder : public TransactionBuilderBase<LoanManageBuilder>
|
||||
{
|
||||
public:
|
||||
LoanManageBuilder(SF_ACCOUNT::type::value_type account,
|
||||
std::decay_t<typename SF_UINT256::type::value_type> const& loanID, std::optional<SF_UINT32::type::value_type> sequence = std::nullopt,
|
||||
std::optional<SF_AMOUNT::type::value_type> fee = std::nullopt
|
||||
)
|
||||
: TransactionBuilderBase<LoanManageBuilder>(ttLOAN_MANAGE, account, sequence, fee)
|
||||
{
|
||||
setLoanID(loanID);
|
||||
}
|
||||
|
||||
LoanManageBuilder(STTx const& tx)
|
||||
{
|
||||
if (tx.getTxnType() != ttLOAN_MANAGE)
|
||||
{
|
||||
throw std::runtime_error("Invalid transaction type for LoanManageBuilder");
|
||||
}
|
||||
object_ = tx;
|
||||
}
|
||||
|
||||
// Transaction-specific field setters
|
||||
|
||||
/**
|
||||
* Set sfLoanID (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
LoanManageBuilder&
|
||||
setLoanID(std::decay_t<typename SF_UINT256::type::value_type> const& value)
|
||||
{
|
||||
object_[sfLoanID] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build and return the completed LoanManage wrapper.
|
||||
* @return The constructed transaction wrapper.
|
||||
* @throws std::runtime_error if the JSON cannot be parsed into a valid transaction.
|
||||
*/
|
||||
LoanManage
|
||||
build()
|
||||
{
|
||||
return LoanManage(STTx(std::move(object_)));
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::transactions
|
||||
@@ -1,136 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STTx.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/TransactionBase.h>
|
||||
#include <xrpl/protocol_autogen/TransactionBuilderBase.h>
|
||||
#include <xrpl/json/json_value.h>
|
||||
|
||||
#include <stdexcept>
|
||||
#include <optional>
|
||||
|
||||
namespace xrpl::transactions {
|
||||
|
||||
// Forward declaration
|
||||
class LoanPayBuilder;
|
||||
|
||||
/**
|
||||
* Transaction: LoanPay
|
||||
* Type: ttLOAN_PAY (84)
|
||||
* Delegable: Delegation::delegable
|
||||
* Amendment: featureLendingProtocol
|
||||
* Privileges: mayAuthorizeMPT | mustModifyVault
|
||||
*
|
||||
* Immutable wrapper around STTx providing type-safe field access.
|
||||
* Use LoanPayBuilder to construct new transactions.
|
||||
*/
|
||||
class LoanPay : public TransactionBase
|
||||
{
|
||||
public:
|
||||
static constexpr xrpl::TxType txType = ttLOAN_PAY;
|
||||
|
||||
/**
|
||||
* Construct a LoanPay transaction wrapper from an existing STTx object.
|
||||
* @throws std::runtime_error if the transaction type doesn't match.
|
||||
*/
|
||||
explicit LoanPay(STTx const& tx)
|
||||
: TransactionBase(tx)
|
||||
{
|
||||
// Verify transaction type
|
||||
if (tx.getTxnType() != txType)
|
||||
{
|
||||
throw std::runtime_error("Invalid transaction type for LoanPay");
|
||||
}
|
||||
}
|
||||
|
||||
// Transaction-specific field getters
|
||||
|
||||
/**
|
||||
* Get sfLoanID (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT256::type::value_type
|
||||
getLoanID() const
|
||||
{
|
||||
return this->tx_.at(sfLoanID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfAmount (soeREQUIRED)
|
||||
* Note: This field supports MPT (Multi-Purpose Token) amounts.
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_AMOUNT::type::value_type
|
||||
getAmount() const
|
||||
{
|
||||
return this->tx_.at(sfAmount);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Builder for LoanPay transactions.
|
||||
* Provides a fluent interface for constructing transactions with method chaining.
|
||||
* Uses Json::Value internally for flexible transaction construction.
|
||||
* Inherits common field setters from TransactionBuilderBase.
|
||||
*/
|
||||
class LoanPayBuilder : public TransactionBuilderBase<LoanPayBuilder>
|
||||
{
|
||||
public:
|
||||
LoanPayBuilder(SF_ACCOUNT::type::value_type account,
|
||||
std::decay_t<typename SF_UINT256::type::value_type> const& loanID, std::decay_t<typename SF_AMOUNT::type::value_type> const& amount, std::optional<SF_UINT32::type::value_type> sequence = std::nullopt,
|
||||
std::optional<SF_AMOUNT::type::value_type> fee = std::nullopt
|
||||
)
|
||||
: TransactionBuilderBase<LoanPayBuilder>(ttLOAN_PAY, account, sequence, fee)
|
||||
{
|
||||
setLoanID(loanID);
|
||||
setAmount(amount);
|
||||
}
|
||||
|
||||
LoanPayBuilder(STTx const& tx)
|
||||
{
|
||||
if (tx.getTxnType() != ttLOAN_PAY)
|
||||
{
|
||||
throw std::runtime_error("Invalid transaction type for LoanPayBuilder");
|
||||
}
|
||||
object_ = tx;
|
||||
}
|
||||
|
||||
// Transaction-specific field setters
|
||||
|
||||
/**
|
||||
* Set sfLoanID (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
LoanPayBuilder&
|
||||
setLoanID(std::decay_t<typename SF_UINT256::type::value_type> const& value)
|
||||
{
|
||||
object_[sfLoanID] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfAmount (soeREQUIRED)
|
||||
* Note: This field supports MPT (Multi-Purpose Token) amounts.
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
LoanPayBuilder&
|
||||
setAmount(std::decay_t<typename SF_AMOUNT::type::value_type> const& value)
|
||||
{
|
||||
object_[sfAmount] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build and return the completed LoanPay wrapper.
|
||||
* @return The constructed transaction wrapper.
|
||||
* @throws std::runtime_error if the JSON cannot be parsed into a valid transaction.
|
||||
*/
|
||||
LoanPay
|
||||
build()
|
||||
{
|
||||
return LoanPay(STTx(std::move(object_)));
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::transactions
|
||||
@@ -1,612 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STTx.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/TransactionBase.h>
|
||||
#include <xrpl/protocol_autogen/TransactionBuilderBase.h>
|
||||
#include <xrpl/json/json_value.h>
|
||||
|
||||
#include <stdexcept>
|
||||
#include <optional>
|
||||
|
||||
namespace xrpl::transactions {
|
||||
|
||||
// Forward declaration
|
||||
class LoanSetBuilder;
|
||||
|
||||
/**
|
||||
* Transaction: LoanSet
|
||||
* Type: ttLOAN_SET (80)
|
||||
* Delegable: Delegation::delegable
|
||||
* Amendment: featureLendingProtocol
|
||||
* Privileges: mayAuthorizeMPT | mustModifyVault
|
||||
*
|
||||
* Immutable wrapper around STTx providing type-safe field access.
|
||||
* Use LoanSetBuilder to construct new transactions.
|
||||
*/
|
||||
class LoanSet : public TransactionBase
|
||||
{
|
||||
public:
|
||||
static constexpr xrpl::TxType txType = ttLOAN_SET;
|
||||
|
||||
/**
|
||||
* Construct a LoanSet transaction wrapper from an existing STTx object.
|
||||
* @throws std::runtime_error if the transaction type doesn't match.
|
||||
*/
|
||||
explicit LoanSet(STTx const& tx)
|
||||
: TransactionBase(tx)
|
||||
{
|
||||
// Verify transaction type
|
||||
if (tx.getTxnType() != txType)
|
||||
{
|
||||
throw std::runtime_error("Invalid transaction type for LoanSet");
|
||||
}
|
||||
}
|
||||
|
||||
// Transaction-specific field getters
|
||||
|
||||
/**
|
||||
* Get sfLoanBrokerID (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT256::type::value_type
|
||||
getLoanBrokerID() const
|
||||
{
|
||||
return this->tx_.at(sfLoanBrokerID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfData (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_VL::type::value_type>
|
||||
getData() const
|
||||
{
|
||||
if (hasData())
|
||||
{
|
||||
return this->tx_.at(sfData);
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasData() const
|
||||
{
|
||||
return this->tx_.isFieldPresent(sfData);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfCounterparty (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_ACCOUNT::type::value_type>
|
||||
getCounterparty() const
|
||||
{
|
||||
if (hasCounterparty())
|
||||
{
|
||||
return this->tx_.at(sfCounterparty);
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasCounterparty() const
|
||||
{
|
||||
return this->tx_.isFieldPresent(sfCounterparty);
|
||||
}
|
||||
/**
|
||||
* Get sfCounterpartySignature (soeOPTIONAL)
|
||||
* Note: This is an untyped field
|
||||
*/
|
||||
[[nodiscard]]
|
||||
std::optional<STObject>
|
||||
getCounterpartySignature() const
|
||||
{
|
||||
if (this->tx_.isFieldPresent(sfCounterpartySignature))
|
||||
return this->tx_.getFieldObject(sfCounterpartySignature);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasCounterpartySignature() const
|
||||
{
|
||||
return this->tx_.isFieldPresent(sfCounterpartySignature);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfLoanOriginationFee (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_NUMBER::type::value_type>
|
||||
getLoanOriginationFee() const
|
||||
{
|
||||
if (hasLoanOriginationFee())
|
||||
{
|
||||
return this->tx_.at(sfLoanOriginationFee);
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasLoanOriginationFee() const
|
||||
{
|
||||
return this->tx_.isFieldPresent(sfLoanOriginationFee);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfLoanServiceFee (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_NUMBER::type::value_type>
|
||||
getLoanServiceFee() const
|
||||
{
|
||||
if (hasLoanServiceFee())
|
||||
{
|
||||
return this->tx_.at(sfLoanServiceFee);
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasLoanServiceFee() const
|
||||
{
|
||||
return this->tx_.isFieldPresent(sfLoanServiceFee);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfLatePaymentFee (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_NUMBER::type::value_type>
|
||||
getLatePaymentFee() const
|
||||
{
|
||||
if (hasLatePaymentFee())
|
||||
{
|
||||
return this->tx_.at(sfLatePaymentFee);
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasLatePaymentFee() const
|
||||
{
|
||||
return this->tx_.isFieldPresent(sfLatePaymentFee);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfClosePaymentFee (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_NUMBER::type::value_type>
|
||||
getClosePaymentFee() const
|
||||
{
|
||||
if (hasClosePaymentFee())
|
||||
{
|
||||
return this->tx_.at(sfClosePaymentFee);
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasClosePaymentFee() const
|
||||
{
|
||||
return this->tx_.isFieldPresent(sfClosePaymentFee);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfOverpaymentFee (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT32::type::value_type>
|
||||
getOverpaymentFee() const
|
||||
{
|
||||
if (hasOverpaymentFee())
|
||||
{
|
||||
return this->tx_.at(sfOverpaymentFee);
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasOverpaymentFee() const
|
||||
{
|
||||
return this->tx_.isFieldPresent(sfOverpaymentFee);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfInterestRate (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT32::type::value_type>
|
||||
getInterestRate() const
|
||||
{
|
||||
if (hasInterestRate())
|
||||
{
|
||||
return this->tx_.at(sfInterestRate);
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasInterestRate() const
|
||||
{
|
||||
return this->tx_.isFieldPresent(sfInterestRate);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfLateInterestRate (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT32::type::value_type>
|
||||
getLateInterestRate() const
|
||||
{
|
||||
if (hasLateInterestRate())
|
||||
{
|
||||
return this->tx_.at(sfLateInterestRate);
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasLateInterestRate() const
|
||||
{
|
||||
return this->tx_.isFieldPresent(sfLateInterestRate);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfCloseInterestRate (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT32::type::value_type>
|
||||
getCloseInterestRate() const
|
||||
{
|
||||
if (hasCloseInterestRate())
|
||||
{
|
||||
return this->tx_.at(sfCloseInterestRate);
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasCloseInterestRate() const
|
||||
{
|
||||
return this->tx_.isFieldPresent(sfCloseInterestRate);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfOverpaymentInterestRate (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT32::type::value_type>
|
||||
getOverpaymentInterestRate() const
|
||||
{
|
||||
if (hasOverpaymentInterestRate())
|
||||
{
|
||||
return this->tx_.at(sfOverpaymentInterestRate);
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasOverpaymentInterestRate() const
|
||||
{
|
||||
return this->tx_.isFieldPresent(sfOverpaymentInterestRate);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfPrincipalRequested (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_NUMBER::type::value_type
|
||||
getPrincipalRequested() const
|
||||
{
|
||||
return this->tx_.at(sfPrincipalRequested);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfPaymentTotal (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT32::type::value_type>
|
||||
getPaymentTotal() const
|
||||
{
|
||||
if (hasPaymentTotal())
|
||||
{
|
||||
return this->tx_.at(sfPaymentTotal);
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasPaymentTotal() const
|
||||
{
|
||||
return this->tx_.isFieldPresent(sfPaymentTotal);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfPaymentInterval (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT32::type::value_type>
|
||||
getPaymentInterval() const
|
||||
{
|
||||
if (hasPaymentInterval())
|
||||
{
|
||||
return this->tx_.at(sfPaymentInterval);
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasPaymentInterval() const
|
||||
{
|
||||
return this->tx_.isFieldPresent(sfPaymentInterval);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfGracePeriod (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT32::type::value_type>
|
||||
getGracePeriod() const
|
||||
{
|
||||
if (hasGracePeriod())
|
||||
{
|
||||
return this->tx_.at(sfGracePeriod);
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasGracePeriod() const
|
||||
{
|
||||
return this->tx_.isFieldPresent(sfGracePeriod);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Builder for LoanSet transactions.
|
||||
* Provides a fluent interface for constructing transactions with method chaining.
|
||||
* Uses Json::Value internally for flexible transaction construction.
|
||||
* Inherits common field setters from TransactionBuilderBase.
|
||||
*/
|
||||
class LoanSetBuilder : public TransactionBuilderBase<LoanSetBuilder>
|
||||
{
|
||||
public:
|
||||
LoanSetBuilder(SF_ACCOUNT::type::value_type account,
|
||||
std::decay_t<typename SF_UINT256::type::value_type> const& loanBrokerID, std::decay_t<typename SF_NUMBER::type::value_type> const& principalRequested, std::optional<SF_UINT32::type::value_type> sequence = std::nullopt,
|
||||
std::optional<SF_AMOUNT::type::value_type> fee = std::nullopt
|
||||
)
|
||||
: TransactionBuilderBase<LoanSetBuilder>(ttLOAN_SET, account, sequence, fee)
|
||||
{
|
||||
setLoanBrokerID(loanBrokerID);
|
||||
setPrincipalRequested(principalRequested);
|
||||
}
|
||||
|
||||
LoanSetBuilder(STTx const& tx)
|
||||
{
|
||||
if (tx.getTxnType() != ttLOAN_SET)
|
||||
{
|
||||
throw std::runtime_error("Invalid transaction type for LoanSetBuilder");
|
||||
}
|
||||
object_ = tx;
|
||||
}
|
||||
|
||||
// Transaction-specific field setters
|
||||
|
||||
/**
|
||||
* Set sfLoanBrokerID (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
LoanSetBuilder&
|
||||
setLoanBrokerID(std::decay_t<typename SF_UINT256::type::value_type> const& value)
|
||||
{
|
||||
object_[sfLoanBrokerID] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfData (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
LoanSetBuilder&
|
||||
setData(std::decay_t<typename SF_VL::type::value_type> const& value)
|
||||
{
|
||||
object_[sfData] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfCounterparty (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
LoanSetBuilder&
|
||||
setCounterparty(std::decay_t<typename SF_ACCOUNT::type::value_type> const& value)
|
||||
{
|
||||
object_[sfCounterparty] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfCounterpartySignature (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
LoanSetBuilder&
|
||||
setCounterpartySignature(STObject const& value)
|
||||
{
|
||||
object_.setFieldObject(sfCounterpartySignature, value);
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfLoanOriginationFee (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
LoanSetBuilder&
|
||||
setLoanOriginationFee(std::decay_t<typename SF_NUMBER::type::value_type> const& value)
|
||||
{
|
||||
object_[sfLoanOriginationFee] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfLoanServiceFee (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
LoanSetBuilder&
|
||||
setLoanServiceFee(std::decay_t<typename SF_NUMBER::type::value_type> const& value)
|
||||
{
|
||||
object_[sfLoanServiceFee] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfLatePaymentFee (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
LoanSetBuilder&
|
||||
setLatePaymentFee(std::decay_t<typename SF_NUMBER::type::value_type> const& value)
|
||||
{
|
||||
object_[sfLatePaymentFee] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfClosePaymentFee (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
LoanSetBuilder&
|
||||
setClosePaymentFee(std::decay_t<typename SF_NUMBER::type::value_type> const& value)
|
||||
{
|
||||
object_[sfClosePaymentFee] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfOverpaymentFee (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
LoanSetBuilder&
|
||||
setOverpaymentFee(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfOverpaymentFee] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfInterestRate (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
LoanSetBuilder&
|
||||
setInterestRate(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfInterestRate] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfLateInterestRate (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
LoanSetBuilder&
|
||||
setLateInterestRate(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfLateInterestRate] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfCloseInterestRate (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
LoanSetBuilder&
|
||||
setCloseInterestRate(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfCloseInterestRate] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfOverpaymentInterestRate (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
LoanSetBuilder&
|
||||
setOverpaymentInterestRate(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfOverpaymentInterestRate] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfPrincipalRequested (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
LoanSetBuilder&
|
||||
setPrincipalRequested(std::decay_t<typename SF_NUMBER::type::value_type> const& value)
|
||||
{
|
||||
object_[sfPrincipalRequested] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfPaymentTotal (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
LoanSetBuilder&
|
||||
setPaymentTotal(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfPaymentTotal] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfPaymentInterval (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
LoanSetBuilder&
|
||||
setPaymentInterval(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfPaymentInterval] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfGracePeriod (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
LoanSetBuilder&
|
||||
setGracePeriod(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfGracePeriod] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build and return the completed LoanSet wrapper.
|
||||
* @return The constructed transaction wrapper.
|
||||
* @throws std::runtime_error if the JSON cannot be parsed into a valid transaction.
|
||||
*/
|
||||
LoanSet
|
||||
build()
|
||||
{
|
||||
return LoanSet(STTx(std::move(object_)));
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::transactions
|
||||
@@ -1,144 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STTx.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/TransactionBase.h>
|
||||
#include <xrpl/protocol_autogen/TransactionBuilderBase.h>
|
||||
#include <xrpl/json/json_value.h>
|
||||
|
||||
#include <stdexcept>
|
||||
#include <optional>
|
||||
|
||||
namespace xrpl::transactions {
|
||||
|
||||
// Forward declaration
|
||||
class MPTokenAuthorizeBuilder;
|
||||
|
||||
/**
|
||||
* Transaction: MPTokenAuthorize
|
||||
* Type: ttMPTOKEN_AUTHORIZE (57)
|
||||
* Delegable: Delegation::delegable
|
||||
* Amendment: featureMPTokensV1
|
||||
* Privileges: mustAuthorizeMPT
|
||||
*
|
||||
* Immutable wrapper around STTx providing type-safe field access.
|
||||
* Use MPTokenAuthorizeBuilder to construct new transactions.
|
||||
*/
|
||||
class MPTokenAuthorize : public TransactionBase
|
||||
{
|
||||
public:
|
||||
static constexpr xrpl::TxType txType = ttMPTOKEN_AUTHORIZE;
|
||||
|
||||
/**
|
||||
* Construct a MPTokenAuthorize transaction wrapper from an existing STTx object.
|
||||
* @throws std::runtime_error if the transaction type doesn't match.
|
||||
*/
|
||||
explicit MPTokenAuthorize(STTx const& tx)
|
||||
: TransactionBase(tx)
|
||||
{
|
||||
// Verify transaction type
|
||||
if (tx.getTxnType() != txType)
|
||||
{
|
||||
throw std::runtime_error("Invalid transaction type for MPTokenAuthorize");
|
||||
}
|
||||
}
|
||||
|
||||
// Transaction-specific field getters
|
||||
|
||||
/**
|
||||
* Get sfMPTokenIssuanceID (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT192::type::value_type
|
||||
getMPTokenIssuanceID() const
|
||||
{
|
||||
return this->tx_.at(sfMPTokenIssuanceID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfHolder (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_ACCOUNT::type::value_type>
|
||||
getHolder() const
|
||||
{
|
||||
if (hasHolder())
|
||||
{
|
||||
return this->tx_.at(sfHolder);
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasHolder() const
|
||||
{
|
||||
return this->tx_.isFieldPresent(sfHolder);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Builder for MPTokenAuthorize transactions.
|
||||
* Provides a fluent interface for constructing transactions with method chaining.
|
||||
* Uses Json::Value internally for flexible transaction construction.
|
||||
* Inherits common field setters from TransactionBuilderBase.
|
||||
*/
|
||||
class MPTokenAuthorizeBuilder : public TransactionBuilderBase<MPTokenAuthorizeBuilder>
|
||||
{
|
||||
public:
|
||||
MPTokenAuthorizeBuilder(SF_ACCOUNT::type::value_type account,
|
||||
std::decay_t<typename SF_UINT192::type::value_type> const& mPTokenIssuanceID, std::optional<SF_UINT32::type::value_type> sequence = std::nullopt,
|
||||
std::optional<SF_AMOUNT::type::value_type> fee = std::nullopt
|
||||
)
|
||||
: TransactionBuilderBase<MPTokenAuthorizeBuilder>(ttMPTOKEN_AUTHORIZE, account, sequence, fee)
|
||||
{
|
||||
setMPTokenIssuanceID(mPTokenIssuanceID);
|
||||
}
|
||||
|
||||
MPTokenAuthorizeBuilder(STTx const& tx)
|
||||
{
|
||||
if (tx.getTxnType() != ttMPTOKEN_AUTHORIZE)
|
||||
{
|
||||
throw std::runtime_error("Invalid transaction type for MPTokenAuthorizeBuilder");
|
||||
}
|
||||
object_ = tx;
|
||||
}
|
||||
|
||||
// Transaction-specific field setters
|
||||
|
||||
/**
|
||||
* Set sfMPTokenIssuanceID (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
MPTokenAuthorizeBuilder&
|
||||
setMPTokenIssuanceID(std::decay_t<typename SF_UINT192::type::value_type> const& value)
|
||||
{
|
||||
object_[sfMPTokenIssuanceID] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfHolder (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
MPTokenAuthorizeBuilder&
|
||||
setHolder(std::decay_t<typename SF_ACCOUNT::type::value_type> const& value)
|
||||
{
|
||||
object_[sfHolder] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build and return the completed MPTokenAuthorize wrapper.
|
||||
* @return The constructed transaction wrapper.
|
||||
* @throws std::runtime_error if the JSON cannot be parsed into a valid transaction.
|
||||
*/
|
||||
MPTokenAuthorize
|
||||
build()
|
||||
{
|
||||
return MPTokenAuthorize(STTx(std::move(object_)));
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::transactions
|
||||
@@ -1,282 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STTx.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/TransactionBase.h>
|
||||
#include <xrpl/protocol_autogen/TransactionBuilderBase.h>
|
||||
#include <xrpl/json/json_value.h>
|
||||
|
||||
#include <stdexcept>
|
||||
#include <optional>
|
||||
|
||||
namespace xrpl::transactions {
|
||||
|
||||
// Forward declaration
|
||||
class MPTokenIssuanceCreateBuilder;
|
||||
|
||||
/**
|
||||
* Transaction: MPTokenIssuanceCreate
|
||||
* Type: ttMPTOKEN_ISSUANCE_CREATE (54)
|
||||
* Delegable: Delegation::delegable
|
||||
* Amendment: featureMPTokensV1
|
||||
* Privileges: createMPTIssuance
|
||||
*
|
||||
* Immutable wrapper around STTx providing type-safe field access.
|
||||
* Use MPTokenIssuanceCreateBuilder to construct new transactions.
|
||||
*/
|
||||
class MPTokenIssuanceCreate : public TransactionBase
|
||||
{
|
||||
public:
|
||||
static constexpr xrpl::TxType txType = ttMPTOKEN_ISSUANCE_CREATE;
|
||||
|
||||
/**
|
||||
* Construct a MPTokenIssuanceCreate transaction wrapper from an existing STTx object.
|
||||
* @throws std::runtime_error if the transaction type doesn't match.
|
||||
*/
|
||||
explicit MPTokenIssuanceCreate(STTx const& tx)
|
||||
: TransactionBase(tx)
|
||||
{
|
||||
// Verify transaction type
|
||||
if (tx.getTxnType() != txType)
|
||||
{
|
||||
throw std::runtime_error("Invalid transaction type for MPTokenIssuanceCreate");
|
||||
}
|
||||
}
|
||||
|
||||
// Transaction-specific field getters
|
||||
|
||||
/**
|
||||
* Get sfAssetScale (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT8::type::value_type>
|
||||
getAssetScale() const
|
||||
{
|
||||
if (hasAssetScale())
|
||||
{
|
||||
return this->tx_.at(sfAssetScale);
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasAssetScale() const
|
||||
{
|
||||
return this->tx_.isFieldPresent(sfAssetScale);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfTransferFee (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT16::type::value_type>
|
||||
getTransferFee() const
|
||||
{
|
||||
if (hasTransferFee())
|
||||
{
|
||||
return this->tx_.at(sfTransferFee);
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasTransferFee() const
|
||||
{
|
||||
return this->tx_.isFieldPresent(sfTransferFee);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfMaximumAmount (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT64::type::value_type>
|
||||
getMaximumAmount() const
|
||||
{
|
||||
if (hasMaximumAmount())
|
||||
{
|
||||
return this->tx_.at(sfMaximumAmount);
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasMaximumAmount() const
|
||||
{
|
||||
return this->tx_.isFieldPresent(sfMaximumAmount);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfMPTokenMetadata (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_VL::type::value_type>
|
||||
getMPTokenMetadata() const
|
||||
{
|
||||
if (hasMPTokenMetadata())
|
||||
{
|
||||
return this->tx_.at(sfMPTokenMetadata);
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasMPTokenMetadata() const
|
||||
{
|
||||
return this->tx_.isFieldPresent(sfMPTokenMetadata);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfDomainID (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT256::type::value_type>
|
||||
getDomainID() const
|
||||
{
|
||||
if (hasDomainID())
|
||||
{
|
||||
return this->tx_.at(sfDomainID);
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasDomainID() const
|
||||
{
|
||||
return this->tx_.isFieldPresent(sfDomainID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfMutableFlags (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT32::type::value_type>
|
||||
getMutableFlags() const
|
||||
{
|
||||
if (hasMutableFlags())
|
||||
{
|
||||
return this->tx_.at(sfMutableFlags);
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasMutableFlags() const
|
||||
{
|
||||
return this->tx_.isFieldPresent(sfMutableFlags);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Builder for MPTokenIssuanceCreate transactions.
|
||||
* Provides a fluent interface for constructing transactions with method chaining.
|
||||
* Uses Json::Value internally for flexible transaction construction.
|
||||
* Inherits common field setters from TransactionBuilderBase.
|
||||
*/
|
||||
class MPTokenIssuanceCreateBuilder : public TransactionBuilderBase<MPTokenIssuanceCreateBuilder>
|
||||
{
|
||||
public:
|
||||
MPTokenIssuanceCreateBuilder(SF_ACCOUNT::type::value_type account,
|
||||
std::optional<SF_UINT32::type::value_type> sequence = std::nullopt,
|
||||
std::optional<SF_AMOUNT::type::value_type> fee = std::nullopt
|
||||
)
|
||||
: TransactionBuilderBase<MPTokenIssuanceCreateBuilder>(ttMPTOKEN_ISSUANCE_CREATE, account, sequence, fee)
|
||||
{
|
||||
}
|
||||
|
||||
MPTokenIssuanceCreateBuilder(STTx const& tx)
|
||||
{
|
||||
if (tx.getTxnType() != ttMPTOKEN_ISSUANCE_CREATE)
|
||||
{
|
||||
throw std::runtime_error("Invalid transaction type for MPTokenIssuanceCreateBuilder");
|
||||
}
|
||||
object_ = tx;
|
||||
}
|
||||
|
||||
// Transaction-specific field setters
|
||||
|
||||
/**
|
||||
* Set sfAssetScale (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
MPTokenIssuanceCreateBuilder&
|
||||
setAssetScale(std::decay_t<typename SF_UINT8::type::value_type> const& value)
|
||||
{
|
||||
object_[sfAssetScale] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfTransferFee (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
MPTokenIssuanceCreateBuilder&
|
||||
setTransferFee(std::decay_t<typename SF_UINT16::type::value_type> const& value)
|
||||
{
|
||||
object_[sfTransferFee] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfMaximumAmount (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
MPTokenIssuanceCreateBuilder&
|
||||
setMaximumAmount(std::decay_t<typename SF_UINT64::type::value_type> const& value)
|
||||
{
|
||||
object_[sfMaximumAmount] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfMPTokenMetadata (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
MPTokenIssuanceCreateBuilder&
|
||||
setMPTokenMetadata(std::decay_t<typename SF_VL::type::value_type> const& value)
|
||||
{
|
||||
object_[sfMPTokenMetadata] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfDomainID (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
MPTokenIssuanceCreateBuilder&
|
||||
setDomainID(std::decay_t<typename SF_UINT256::type::value_type> const& value)
|
||||
{
|
||||
object_[sfDomainID] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfMutableFlags (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
MPTokenIssuanceCreateBuilder&
|
||||
setMutableFlags(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfMutableFlags] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build and return the completed MPTokenIssuanceCreate wrapper.
|
||||
* @return The constructed transaction wrapper.
|
||||
* @throws std::runtime_error if the JSON cannot be parsed into a valid transaction.
|
||||
*/
|
||||
MPTokenIssuanceCreate
|
||||
build()
|
||||
{
|
||||
return MPTokenIssuanceCreate(STTx(std::move(object_)));
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::transactions
|
||||
@@ -1,112 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STTx.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/TransactionBase.h>
|
||||
#include <xrpl/protocol_autogen/TransactionBuilderBase.h>
|
||||
#include <xrpl/json/json_value.h>
|
||||
|
||||
#include <stdexcept>
|
||||
#include <optional>
|
||||
|
||||
namespace xrpl::transactions {
|
||||
|
||||
// Forward declaration
|
||||
class MPTokenIssuanceDestroyBuilder;
|
||||
|
||||
/**
|
||||
* Transaction: MPTokenIssuanceDestroy
|
||||
* Type: ttMPTOKEN_ISSUANCE_DESTROY (55)
|
||||
* Delegable: Delegation::delegable
|
||||
* Amendment: featureMPTokensV1
|
||||
* Privileges: destroyMPTIssuance
|
||||
*
|
||||
* Immutable wrapper around STTx providing type-safe field access.
|
||||
* Use MPTokenIssuanceDestroyBuilder to construct new transactions.
|
||||
*/
|
||||
class MPTokenIssuanceDestroy : public TransactionBase
|
||||
{
|
||||
public:
|
||||
static constexpr xrpl::TxType txType = ttMPTOKEN_ISSUANCE_DESTROY;
|
||||
|
||||
/**
|
||||
* Construct a MPTokenIssuanceDestroy transaction wrapper from an existing STTx object.
|
||||
* @throws std::runtime_error if the transaction type doesn't match.
|
||||
*/
|
||||
explicit MPTokenIssuanceDestroy(STTx const& tx)
|
||||
: TransactionBase(tx)
|
||||
{
|
||||
// Verify transaction type
|
||||
if (tx.getTxnType() != txType)
|
||||
{
|
||||
throw std::runtime_error("Invalid transaction type for MPTokenIssuanceDestroy");
|
||||
}
|
||||
}
|
||||
|
||||
// Transaction-specific field getters
|
||||
|
||||
/**
|
||||
* Get sfMPTokenIssuanceID (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT192::type::value_type
|
||||
getMPTokenIssuanceID() const
|
||||
{
|
||||
return this->tx_.at(sfMPTokenIssuanceID);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Builder for MPTokenIssuanceDestroy transactions.
|
||||
* Provides a fluent interface for constructing transactions with method chaining.
|
||||
* Uses Json::Value internally for flexible transaction construction.
|
||||
* Inherits common field setters from TransactionBuilderBase.
|
||||
*/
|
||||
class MPTokenIssuanceDestroyBuilder : public TransactionBuilderBase<MPTokenIssuanceDestroyBuilder>
|
||||
{
|
||||
public:
|
||||
MPTokenIssuanceDestroyBuilder(SF_ACCOUNT::type::value_type account,
|
||||
std::decay_t<typename SF_UINT192::type::value_type> const& mPTokenIssuanceID, std::optional<SF_UINT32::type::value_type> sequence = std::nullopt,
|
||||
std::optional<SF_AMOUNT::type::value_type> fee = std::nullopt
|
||||
)
|
||||
: TransactionBuilderBase<MPTokenIssuanceDestroyBuilder>(ttMPTOKEN_ISSUANCE_DESTROY, account, sequence, fee)
|
||||
{
|
||||
setMPTokenIssuanceID(mPTokenIssuanceID);
|
||||
}
|
||||
|
||||
MPTokenIssuanceDestroyBuilder(STTx const& tx)
|
||||
{
|
||||
if (tx.getTxnType() != ttMPTOKEN_ISSUANCE_DESTROY)
|
||||
{
|
||||
throw std::runtime_error("Invalid transaction type for MPTokenIssuanceDestroyBuilder");
|
||||
}
|
||||
object_ = tx;
|
||||
}
|
||||
|
||||
// Transaction-specific field setters
|
||||
|
||||
/**
|
||||
* Set sfMPTokenIssuanceID (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
MPTokenIssuanceDestroyBuilder&
|
||||
setMPTokenIssuanceID(std::decay_t<typename SF_UINT192::type::value_type> const& value)
|
||||
{
|
||||
object_[sfMPTokenIssuanceID] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build and return the completed MPTokenIssuanceDestroy wrapper.
|
||||
* @return The constructed transaction wrapper.
|
||||
* @throws std::runtime_error if the JSON cannot be parsed into a valid transaction.
|
||||
*/
|
||||
MPTokenIssuanceDestroy
|
||||
build()
|
||||
{
|
||||
return MPTokenIssuanceDestroy(STTx(std::move(object_)));
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::transactions
|
||||
@@ -1,272 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STTx.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/TransactionBase.h>
|
||||
#include <xrpl/protocol_autogen/TransactionBuilderBase.h>
|
||||
#include <xrpl/json/json_value.h>
|
||||
|
||||
#include <stdexcept>
|
||||
#include <optional>
|
||||
|
||||
namespace xrpl::transactions {
|
||||
|
||||
// Forward declaration
|
||||
class MPTokenIssuanceSetBuilder;
|
||||
|
||||
/**
|
||||
* Transaction: MPTokenIssuanceSet
|
||||
* Type: ttMPTOKEN_ISSUANCE_SET (56)
|
||||
* Delegable: Delegation::delegable
|
||||
* Amendment: featureMPTokensV1
|
||||
* Privileges: noPriv
|
||||
*
|
||||
* Immutable wrapper around STTx providing type-safe field access.
|
||||
* Use MPTokenIssuanceSetBuilder to construct new transactions.
|
||||
*/
|
||||
class MPTokenIssuanceSet : public TransactionBase
|
||||
{
|
||||
public:
|
||||
static constexpr xrpl::TxType txType = ttMPTOKEN_ISSUANCE_SET;
|
||||
|
||||
/**
|
||||
* Construct a MPTokenIssuanceSet transaction wrapper from an existing STTx object.
|
||||
* @throws std::runtime_error if the transaction type doesn't match.
|
||||
*/
|
||||
explicit MPTokenIssuanceSet(STTx const& tx)
|
||||
: TransactionBase(tx)
|
||||
{
|
||||
// Verify transaction type
|
||||
if (tx.getTxnType() != txType)
|
||||
{
|
||||
throw std::runtime_error("Invalid transaction type for MPTokenIssuanceSet");
|
||||
}
|
||||
}
|
||||
|
||||
// Transaction-specific field getters
|
||||
|
||||
/**
|
||||
* Get sfMPTokenIssuanceID (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT192::type::value_type
|
||||
getMPTokenIssuanceID() const
|
||||
{
|
||||
return this->tx_.at(sfMPTokenIssuanceID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfHolder (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_ACCOUNT::type::value_type>
|
||||
getHolder() const
|
||||
{
|
||||
if (hasHolder())
|
||||
{
|
||||
return this->tx_.at(sfHolder);
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasHolder() const
|
||||
{
|
||||
return this->tx_.isFieldPresent(sfHolder);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfDomainID (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT256::type::value_type>
|
||||
getDomainID() const
|
||||
{
|
||||
if (hasDomainID())
|
||||
{
|
||||
return this->tx_.at(sfDomainID);
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasDomainID() const
|
||||
{
|
||||
return this->tx_.isFieldPresent(sfDomainID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfMPTokenMetadata (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_VL::type::value_type>
|
||||
getMPTokenMetadata() const
|
||||
{
|
||||
if (hasMPTokenMetadata())
|
||||
{
|
||||
return this->tx_.at(sfMPTokenMetadata);
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasMPTokenMetadata() const
|
||||
{
|
||||
return this->tx_.isFieldPresent(sfMPTokenMetadata);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfTransferFee (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT16::type::value_type>
|
||||
getTransferFee() const
|
||||
{
|
||||
if (hasTransferFee())
|
||||
{
|
||||
return this->tx_.at(sfTransferFee);
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasTransferFee() const
|
||||
{
|
||||
return this->tx_.isFieldPresent(sfTransferFee);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfMutableFlags (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT32::type::value_type>
|
||||
getMutableFlags() const
|
||||
{
|
||||
if (hasMutableFlags())
|
||||
{
|
||||
return this->tx_.at(sfMutableFlags);
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasMutableFlags() const
|
||||
{
|
||||
return this->tx_.isFieldPresent(sfMutableFlags);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Builder for MPTokenIssuanceSet transactions.
|
||||
* Provides a fluent interface for constructing transactions with method chaining.
|
||||
* Uses Json::Value internally for flexible transaction construction.
|
||||
* Inherits common field setters from TransactionBuilderBase.
|
||||
*/
|
||||
class MPTokenIssuanceSetBuilder : public TransactionBuilderBase<MPTokenIssuanceSetBuilder>
|
||||
{
|
||||
public:
|
||||
MPTokenIssuanceSetBuilder(SF_ACCOUNT::type::value_type account,
|
||||
std::decay_t<typename SF_UINT192::type::value_type> const& mPTokenIssuanceID, std::optional<SF_UINT32::type::value_type> sequence = std::nullopt,
|
||||
std::optional<SF_AMOUNT::type::value_type> fee = std::nullopt
|
||||
)
|
||||
: TransactionBuilderBase<MPTokenIssuanceSetBuilder>(ttMPTOKEN_ISSUANCE_SET, account, sequence, fee)
|
||||
{
|
||||
setMPTokenIssuanceID(mPTokenIssuanceID);
|
||||
}
|
||||
|
||||
MPTokenIssuanceSetBuilder(STTx const& tx)
|
||||
{
|
||||
if (tx.getTxnType() != ttMPTOKEN_ISSUANCE_SET)
|
||||
{
|
||||
throw std::runtime_error("Invalid transaction type for MPTokenIssuanceSetBuilder");
|
||||
}
|
||||
object_ = tx;
|
||||
}
|
||||
|
||||
// Transaction-specific field setters
|
||||
|
||||
/**
|
||||
* Set sfMPTokenIssuanceID (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
MPTokenIssuanceSetBuilder&
|
||||
setMPTokenIssuanceID(std::decay_t<typename SF_UINT192::type::value_type> const& value)
|
||||
{
|
||||
object_[sfMPTokenIssuanceID] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfHolder (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
MPTokenIssuanceSetBuilder&
|
||||
setHolder(std::decay_t<typename SF_ACCOUNT::type::value_type> const& value)
|
||||
{
|
||||
object_[sfHolder] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfDomainID (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
MPTokenIssuanceSetBuilder&
|
||||
setDomainID(std::decay_t<typename SF_UINT256::type::value_type> const& value)
|
||||
{
|
||||
object_[sfDomainID] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfMPTokenMetadata (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
MPTokenIssuanceSetBuilder&
|
||||
setMPTokenMetadata(std::decay_t<typename SF_VL::type::value_type> const& value)
|
||||
{
|
||||
object_[sfMPTokenMetadata] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfTransferFee (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
MPTokenIssuanceSetBuilder&
|
||||
setTransferFee(std::decay_t<typename SF_UINT16::type::value_type> const& value)
|
||||
{
|
||||
object_[sfTransferFee] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfMutableFlags (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
MPTokenIssuanceSetBuilder&
|
||||
setMutableFlags(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfMutableFlags] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build and return the completed MPTokenIssuanceSet wrapper.
|
||||
* @return The constructed transaction wrapper.
|
||||
* @throws std::runtime_error if the JSON cannot be parsed into a valid transaction.
|
||||
*/
|
||||
MPTokenIssuanceSet
|
||||
build()
|
||||
{
|
||||
return MPTokenIssuanceSet(STTx(std::move(object_)));
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::transactions
|
||||
@@ -1,186 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STTx.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/TransactionBase.h>
|
||||
#include <xrpl/protocol_autogen/TransactionBuilderBase.h>
|
||||
#include <xrpl/json/json_value.h>
|
||||
|
||||
#include <stdexcept>
|
||||
#include <optional>
|
||||
|
||||
namespace xrpl::transactions {
|
||||
|
||||
// Forward declaration
|
||||
class NFTokenAcceptOfferBuilder;
|
||||
|
||||
/**
|
||||
* Transaction: NFTokenAcceptOffer
|
||||
* Type: ttNFTOKEN_ACCEPT_OFFER (29)
|
||||
* Delegable: Delegation::delegable
|
||||
* Amendment: uint256{}
|
||||
* Privileges: noPriv
|
||||
*
|
||||
* Immutable wrapper around STTx providing type-safe field access.
|
||||
* Use NFTokenAcceptOfferBuilder to construct new transactions.
|
||||
*/
|
||||
class NFTokenAcceptOffer : public TransactionBase
|
||||
{
|
||||
public:
|
||||
static constexpr xrpl::TxType txType = ttNFTOKEN_ACCEPT_OFFER;
|
||||
|
||||
/**
|
||||
* Construct a NFTokenAcceptOffer transaction wrapper from an existing STTx object.
|
||||
* @throws std::runtime_error if the transaction type doesn't match.
|
||||
*/
|
||||
explicit NFTokenAcceptOffer(STTx const& tx)
|
||||
: TransactionBase(tx)
|
||||
{
|
||||
// Verify transaction type
|
||||
if (tx.getTxnType() != txType)
|
||||
{
|
||||
throw std::runtime_error("Invalid transaction type for NFTokenAcceptOffer");
|
||||
}
|
||||
}
|
||||
|
||||
// Transaction-specific field getters
|
||||
|
||||
/**
|
||||
* Get sfNFTokenBuyOffer (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT256::type::value_type>
|
||||
getNFTokenBuyOffer() const
|
||||
{
|
||||
if (hasNFTokenBuyOffer())
|
||||
{
|
||||
return this->tx_.at(sfNFTokenBuyOffer);
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasNFTokenBuyOffer() const
|
||||
{
|
||||
return this->tx_.isFieldPresent(sfNFTokenBuyOffer);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfNFTokenSellOffer (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT256::type::value_type>
|
||||
getNFTokenSellOffer() const
|
||||
{
|
||||
if (hasNFTokenSellOffer())
|
||||
{
|
||||
return this->tx_.at(sfNFTokenSellOffer);
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasNFTokenSellOffer() const
|
||||
{
|
||||
return this->tx_.isFieldPresent(sfNFTokenSellOffer);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfNFTokenBrokerFee (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_AMOUNT::type::value_type>
|
||||
getNFTokenBrokerFee() const
|
||||
{
|
||||
if (hasNFTokenBrokerFee())
|
||||
{
|
||||
return this->tx_.at(sfNFTokenBrokerFee);
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasNFTokenBrokerFee() const
|
||||
{
|
||||
return this->tx_.isFieldPresent(sfNFTokenBrokerFee);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Builder for NFTokenAcceptOffer transactions.
|
||||
* Provides a fluent interface for constructing transactions with method chaining.
|
||||
* Uses Json::Value internally for flexible transaction construction.
|
||||
* Inherits common field setters from TransactionBuilderBase.
|
||||
*/
|
||||
class NFTokenAcceptOfferBuilder : public TransactionBuilderBase<NFTokenAcceptOfferBuilder>
|
||||
{
|
||||
public:
|
||||
NFTokenAcceptOfferBuilder(SF_ACCOUNT::type::value_type account,
|
||||
std::optional<SF_UINT32::type::value_type> sequence = std::nullopt,
|
||||
std::optional<SF_AMOUNT::type::value_type> fee = std::nullopt
|
||||
)
|
||||
: TransactionBuilderBase<NFTokenAcceptOfferBuilder>(ttNFTOKEN_ACCEPT_OFFER, account, sequence, fee)
|
||||
{
|
||||
}
|
||||
|
||||
NFTokenAcceptOfferBuilder(STTx const& tx)
|
||||
{
|
||||
if (tx.getTxnType() != ttNFTOKEN_ACCEPT_OFFER)
|
||||
{
|
||||
throw std::runtime_error("Invalid transaction type for NFTokenAcceptOfferBuilder");
|
||||
}
|
||||
object_ = tx;
|
||||
}
|
||||
|
||||
// Transaction-specific field setters
|
||||
|
||||
/**
|
||||
* Set sfNFTokenBuyOffer (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
NFTokenAcceptOfferBuilder&
|
||||
setNFTokenBuyOffer(std::decay_t<typename SF_UINT256::type::value_type> const& value)
|
||||
{
|
||||
object_[sfNFTokenBuyOffer] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfNFTokenSellOffer (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
NFTokenAcceptOfferBuilder&
|
||||
setNFTokenSellOffer(std::decay_t<typename SF_UINT256::type::value_type> const& value)
|
||||
{
|
||||
object_[sfNFTokenSellOffer] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfNFTokenBrokerFee (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
NFTokenAcceptOfferBuilder&
|
||||
setNFTokenBrokerFee(std::decay_t<typename SF_AMOUNT::type::value_type> const& value)
|
||||
{
|
||||
object_[sfNFTokenBrokerFee] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build and return the completed NFTokenAcceptOffer wrapper.
|
||||
* @return The constructed transaction wrapper.
|
||||
* @throws std::runtime_error if the JSON cannot be parsed into a valid transaction.
|
||||
*/
|
||||
NFTokenAcceptOffer
|
||||
build()
|
||||
{
|
||||
return NFTokenAcceptOffer(STTx(std::move(object_)));
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::transactions
|
||||
@@ -1,144 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STTx.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/TransactionBase.h>
|
||||
#include <xrpl/protocol_autogen/TransactionBuilderBase.h>
|
||||
#include <xrpl/json/json_value.h>
|
||||
|
||||
#include <stdexcept>
|
||||
#include <optional>
|
||||
|
||||
namespace xrpl::transactions {
|
||||
|
||||
// Forward declaration
|
||||
class NFTokenBurnBuilder;
|
||||
|
||||
/**
|
||||
* Transaction: NFTokenBurn
|
||||
* Type: ttNFTOKEN_BURN (26)
|
||||
* Delegable: Delegation::delegable
|
||||
* Amendment: uint256{}
|
||||
* Privileges: changeNFTCounts
|
||||
*
|
||||
* Immutable wrapper around STTx providing type-safe field access.
|
||||
* Use NFTokenBurnBuilder to construct new transactions.
|
||||
*/
|
||||
class NFTokenBurn : public TransactionBase
|
||||
{
|
||||
public:
|
||||
static constexpr xrpl::TxType txType = ttNFTOKEN_BURN;
|
||||
|
||||
/**
|
||||
* Construct a NFTokenBurn transaction wrapper from an existing STTx object.
|
||||
* @throws std::runtime_error if the transaction type doesn't match.
|
||||
*/
|
||||
explicit NFTokenBurn(STTx const& tx)
|
||||
: TransactionBase(tx)
|
||||
{
|
||||
// Verify transaction type
|
||||
if (tx.getTxnType() != txType)
|
||||
{
|
||||
throw std::runtime_error("Invalid transaction type for NFTokenBurn");
|
||||
}
|
||||
}
|
||||
|
||||
// Transaction-specific field getters
|
||||
|
||||
/**
|
||||
* Get sfNFTokenID (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT256::type::value_type
|
||||
getNFTokenID() const
|
||||
{
|
||||
return this->tx_.at(sfNFTokenID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfOwner (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_ACCOUNT::type::value_type>
|
||||
getOwner() const
|
||||
{
|
||||
if (hasOwner())
|
||||
{
|
||||
return this->tx_.at(sfOwner);
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasOwner() const
|
||||
{
|
||||
return this->tx_.isFieldPresent(sfOwner);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Builder for NFTokenBurn transactions.
|
||||
* Provides a fluent interface for constructing transactions with method chaining.
|
||||
* Uses Json::Value internally for flexible transaction construction.
|
||||
* Inherits common field setters from TransactionBuilderBase.
|
||||
*/
|
||||
class NFTokenBurnBuilder : public TransactionBuilderBase<NFTokenBurnBuilder>
|
||||
{
|
||||
public:
|
||||
NFTokenBurnBuilder(SF_ACCOUNT::type::value_type account,
|
||||
std::decay_t<typename SF_UINT256::type::value_type> const& nFTokenID, std::optional<SF_UINT32::type::value_type> sequence = std::nullopt,
|
||||
std::optional<SF_AMOUNT::type::value_type> fee = std::nullopt
|
||||
)
|
||||
: TransactionBuilderBase<NFTokenBurnBuilder>(ttNFTOKEN_BURN, account, sequence, fee)
|
||||
{
|
||||
setNFTokenID(nFTokenID);
|
||||
}
|
||||
|
||||
NFTokenBurnBuilder(STTx const& tx)
|
||||
{
|
||||
if (tx.getTxnType() != ttNFTOKEN_BURN)
|
||||
{
|
||||
throw std::runtime_error("Invalid transaction type for NFTokenBurnBuilder");
|
||||
}
|
||||
object_ = tx;
|
||||
}
|
||||
|
||||
// Transaction-specific field setters
|
||||
|
||||
/**
|
||||
* Set sfNFTokenID (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
NFTokenBurnBuilder&
|
||||
setNFTokenID(std::decay_t<typename SF_UINT256::type::value_type> const& value)
|
||||
{
|
||||
object_[sfNFTokenID] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfOwner (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
NFTokenBurnBuilder&
|
||||
setOwner(std::decay_t<typename SF_ACCOUNT::type::value_type> const& value)
|
||||
{
|
||||
object_[sfOwner] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build and return the completed NFTokenBurn wrapper.
|
||||
* @return The constructed transaction wrapper.
|
||||
* @throws std::runtime_error if the JSON cannot be parsed into a valid transaction.
|
||||
*/
|
||||
NFTokenBurn
|
||||
build()
|
||||
{
|
||||
return NFTokenBurn(STTx(std::move(object_)));
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::transactions
|
||||
@@ -1,112 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STTx.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/TransactionBase.h>
|
||||
#include <xrpl/protocol_autogen/TransactionBuilderBase.h>
|
||||
#include <xrpl/json/json_value.h>
|
||||
|
||||
#include <stdexcept>
|
||||
#include <optional>
|
||||
|
||||
namespace xrpl::transactions {
|
||||
|
||||
// Forward declaration
|
||||
class NFTokenCancelOfferBuilder;
|
||||
|
||||
/**
|
||||
* Transaction: NFTokenCancelOffer
|
||||
* Type: ttNFTOKEN_CANCEL_OFFER (28)
|
||||
* Delegable: Delegation::delegable
|
||||
* Amendment: uint256{}
|
||||
* Privileges: noPriv
|
||||
*
|
||||
* Immutable wrapper around STTx providing type-safe field access.
|
||||
* Use NFTokenCancelOfferBuilder to construct new transactions.
|
||||
*/
|
||||
class NFTokenCancelOffer : public TransactionBase
|
||||
{
|
||||
public:
|
||||
static constexpr xrpl::TxType txType = ttNFTOKEN_CANCEL_OFFER;
|
||||
|
||||
/**
|
||||
* Construct a NFTokenCancelOffer transaction wrapper from an existing STTx object.
|
||||
* @throws std::runtime_error if the transaction type doesn't match.
|
||||
*/
|
||||
explicit NFTokenCancelOffer(STTx const& tx)
|
||||
: TransactionBase(tx)
|
||||
{
|
||||
// Verify transaction type
|
||||
if (tx.getTxnType() != txType)
|
||||
{
|
||||
throw std::runtime_error("Invalid transaction type for NFTokenCancelOffer");
|
||||
}
|
||||
}
|
||||
|
||||
// Transaction-specific field getters
|
||||
|
||||
/**
|
||||
* Get sfNFTokenOffers (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_VECTOR256::type::value_type
|
||||
getNFTokenOffers() const
|
||||
{
|
||||
return this->tx_.at(sfNFTokenOffers);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Builder for NFTokenCancelOffer transactions.
|
||||
* Provides a fluent interface for constructing transactions with method chaining.
|
||||
* Uses Json::Value internally for flexible transaction construction.
|
||||
* Inherits common field setters from TransactionBuilderBase.
|
||||
*/
|
||||
class NFTokenCancelOfferBuilder : public TransactionBuilderBase<NFTokenCancelOfferBuilder>
|
||||
{
|
||||
public:
|
||||
NFTokenCancelOfferBuilder(SF_ACCOUNT::type::value_type account,
|
||||
std::decay_t<typename SF_VECTOR256::type::value_type> const& nFTokenOffers, std::optional<SF_UINT32::type::value_type> sequence = std::nullopt,
|
||||
std::optional<SF_AMOUNT::type::value_type> fee = std::nullopt
|
||||
)
|
||||
: TransactionBuilderBase<NFTokenCancelOfferBuilder>(ttNFTOKEN_CANCEL_OFFER, account, sequence, fee)
|
||||
{
|
||||
setNFTokenOffers(nFTokenOffers);
|
||||
}
|
||||
|
||||
NFTokenCancelOfferBuilder(STTx const& tx)
|
||||
{
|
||||
if (tx.getTxnType() != ttNFTOKEN_CANCEL_OFFER)
|
||||
{
|
||||
throw std::runtime_error("Invalid transaction type for NFTokenCancelOfferBuilder");
|
||||
}
|
||||
object_ = tx;
|
||||
}
|
||||
|
||||
// Transaction-specific field setters
|
||||
|
||||
/**
|
||||
* Set sfNFTokenOffers (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
NFTokenCancelOfferBuilder&
|
||||
setNFTokenOffers(std::decay_t<typename SF_VECTOR256::type::value_type> const& value)
|
||||
{
|
||||
object_[sfNFTokenOffers] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build and return the completed NFTokenCancelOffer wrapper.
|
||||
* @return The constructed transaction wrapper.
|
||||
* @throws std::runtime_error if the JSON cannot be parsed into a valid transaction.
|
||||
*/
|
||||
NFTokenCancelOffer
|
||||
build()
|
||||
{
|
||||
return NFTokenCancelOffer(STTx(std::move(object_)));
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::transactions
|
||||
@@ -1,230 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STTx.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/TransactionBase.h>
|
||||
#include <xrpl/protocol_autogen/TransactionBuilderBase.h>
|
||||
#include <xrpl/json/json_value.h>
|
||||
|
||||
#include <stdexcept>
|
||||
#include <optional>
|
||||
|
||||
namespace xrpl::transactions {
|
||||
|
||||
// Forward declaration
|
||||
class NFTokenCreateOfferBuilder;
|
||||
|
||||
/**
|
||||
* Transaction: NFTokenCreateOffer
|
||||
* Type: ttNFTOKEN_CREATE_OFFER (27)
|
||||
* Delegable: Delegation::delegable
|
||||
* Amendment: uint256{}
|
||||
* Privileges: noPriv
|
||||
*
|
||||
* Immutable wrapper around STTx providing type-safe field access.
|
||||
* Use NFTokenCreateOfferBuilder to construct new transactions.
|
||||
*/
|
||||
class NFTokenCreateOffer : public TransactionBase
|
||||
{
|
||||
public:
|
||||
static constexpr xrpl::TxType txType = ttNFTOKEN_CREATE_OFFER;
|
||||
|
||||
/**
|
||||
* Construct a NFTokenCreateOffer transaction wrapper from an existing STTx object.
|
||||
* @throws std::runtime_error if the transaction type doesn't match.
|
||||
*/
|
||||
explicit NFTokenCreateOffer(STTx const& tx)
|
||||
: TransactionBase(tx)
|
||||
{
|
||||
// Verify transaction type
|
||||
if (tx.getTxnType() != txType)
|
||||
{
|
||||
throw std::runtime_error("Invalid transaction type for NFTokenCreateOffer");
|
||||
}
|
||||
}
|
||||
|
||||
// Transaction-specific field getters
|
||||
|
||||
/**
|
||||
* Get sfNFTokenID (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT256::type::value_type
|
||||
getNFTokenID() const
|
||||
{
|
||||
return this->tx_.at(sfNFTokenID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfAmount (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_AMOUNT::type::value_type
|
||||
getAmount() const
|
||||
{
|
||||
return this->tx_.at(sfAmount);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfDestination (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_ACCOUNT::type::value_type>
|
||||
getDestination() const
|
||||
{
|
||||
if (hasDestination())
|
||||
{
|
||||
return this->tx_.at(sfDestination);
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasDestination() const
|
||||
{
|
||||
return this->tx_.isFieldPresent(sfDestination);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfOwner (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_ACCOUNT::type::value_type>
|
||||
getOwner() const
|
||||
{
|
||||
if (hasOwner())
|
||||
{
|
||||
return this->tx_.at(sfOwner);
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasOwner() const
|
||||
{
|
||||
return this->tx_.isFieldPresent(sfOwner);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfExpiration (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT32::type::value_type>
|
||||
getExpiration() const
|
||||
{
|
||||
if (hasExpiration())
|
||||
{
|
||||
return this->tx_.at(sfExpiration);
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasExpiration() const
|
||||
{
|
||||
return this->tx_.isFieldPresent(sfExpiration);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Builder for NFTokenCreateOffer transactions.
|
||||
* Provides a fluent interface for constructing transactions with method chaining.
|
||||
* Uses Json::Value internally for flexible transaction construction.
|
||||
* Inherits common field setters from TransactionBuilderBase.
|
||||
*/
|
||||
class NFTokenCreateOfferBuilder : public TransactionBuilderBase<NFTokenCreateOfferBuilder>
|
||||
{
|
||||
public:
|
||||
NFTokenCreateOfferBuilder(SF_ACCOUNT::type::value_type account,
|
||||
std::decay_t<typename SF_UINT256::type::value_type> const& nFTokenID, std::decay_t<typename SF_AMOUNT::type::value_type> const& amount, std::optional<SF_UINT32::type::value_type> sequence = std::nullopt,
|
||||
std::optional<SF_AMOUNT::type::value_type> fee = std::nullopt
|
||||
)
|
||||
: TransactionBuilderBase<NFTokenCreateOfferBuilder>(ttNFTOKEN_CREATE_OFFER, account, sequence, fee)
|
||||
{
|
||||
setNFTokenID(nFTokenID);
|
||||
setAmount(amount);
|
||||
}
|
||||
|
||||
NFTokenCreateOfferBuilder(STTx const& tx)
|
||||
{
|
||||
if (tx.getTxnType() != ttNFTOKEN_CREATE_OFFER)
|
||||
{
|
||||
throw std::runtime_error("Invalid transaction type for NFTokenCreateOfferBuilder");
|
||||
}
|
||||
object_ = tx;
|
||||
}
|
||||
|
||||
// Transaction-specific field setters
|
||||
|
||||
/**
|
||||
* Set sfNFTokenID (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
NFTokenCreateOfferBuilder&
|
||||
setNFTokenID(std::decay_t<typename SF_UINT256::type::value_type> const& value)
|
||||
{
|
||||
object_[sfNFTokenID] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfAmount (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
NFTokenCreateOfferBuilder&
|
||||
setAmount(std::decay_t<typename SF_AMOUNT::type::value_type> const& value)
|
||||
{
|
||||
object_[sfAmount] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfDestination (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
NFTokenCreateOfferBuilder&
|
||||
setDestination(std::decay_t<typename SF_ACCOUNT::type::value_type> const& value)
|
||||
{
|
||||
object_[sfDestination] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfOwner (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
NFTokenCreateOfferBuilder&
|
||||
setOwner(std::decay_t<typename SF_ACCOUNT::type::value_type> const& value)
|
||||
{
|
||||
object_[sfOwner] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfExpiration (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
NFTokenCreateOfferBuilder&
|
||||
setExpiration(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfExpiration] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build and return the completed NFTokenCreateOffer wrapper.
|
||||
* @return The constructed transaction wrapper.
|
||||
* @throws std::runtime_error if the JSON cannot be parsed into a valid transaction.
|
||||
*/
|
||||
NFTokenCreateOffer
|
||||
build()
|
||||
{
|
||||
return NFTokenCreateOffer(STTx(std::move(object_)));
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::transactions
|
||||
@@ -1,304 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STTx.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/TransactionBase.h>
|
||||
#include <xrpl/protocol_autogen/TransactionBuilderBase.h>
|
||||
#include <xrpl/json/json_value.h>
|
||||
|
||||
#include <stdexcept>
|
||||
#include <optional>
|
||||
|
||||
namespace xrpl::transactions {
|
||||
|
||||
// Forward declaration
|
||||
class NFTokenMintBuilder;
|
||||
|
||||
/**
|
||||
* Transaction: NFTokenMint
|
||||
* Type: ttNFTOKEN_MINT (25)
|
||||
* Delegable: Delegation::delegable
|
||||
* Amendment: uint256{}
|
||||
* Privileges: changeNFTCounts
|
||||
*
|
||||
* Immutable wrapper around STTx providing type-safe field access.
|
||||
* Use NFTokenMintBuilder to construct new transactions.
|
||||
*/
|
||||
class NFTokenMint : public TransactionBase
|
||||
{
|
||||
public:
|
||||
static constexpr xrpl::TxType txType = ttNFTOKEN_MINT;
|
||||
|
||||
/**
|
||||
* Construct a NFTokenMint transaction wrapper from an existing STTx object.
|
||||
* @throws std::runtime_error if the transaction type doesn't match.
|
||||
*/
|
||||
explicit NFTokenMint(STTx const& tx)
|
||||
: TransactionBase(tx)
|
||||
{
|
||||
// Verify transaction type
|
||||
if (tx.getTxnType() != txType)
|
||||
{
|
||||
throw std::runtime_error("Invalid transaction type for NFTokenMint");
|
||||
}
|
||||
}
|
||||
|
||||
// Transaction-specific field getters
|
||||
|
||||
/**
|
||||
* Get sfNFTokenTaxon (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT32::type::value_type
|
||||
getNFTokenTaxon() const
|
||||
{
|
||||
return this->tx_.at(sfNFTokenTaxon);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfTransferFee (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT16::type::value_type>
|
||||
getTransferFee() const
|
||||
{
|
||||
if (hasTransferFee())
|
||||
{
|
||||
return this->tx_.at(sfTransferFee);
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasTransferFee() const
|
||||
{
|
||||
return this->tx_.isFieldPresent(sfTransferFee);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfIssuer (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_ACCOUNT::type::value_type>
|
||||
getIssuer() const
|
||||
{
|
||||
if (hasIssuer())
|
||||
{
|
||||
return this->tx_.at(sfIssuer);
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasIssuer() const
|
||||
{
|
||||
return this->tx_.isFieldPresent(sfIssuer);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfURI (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_VL::type::value_type>
|
||||
getURI() const
|
||||
{
|
||||
if (hasURI())
|
||||
{
|
||||
return this->tx_.at(sfURI);
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasURI() const
|
||||
{
|
||||
return this->tx_.isFieldPresent(sfURI);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfAmount (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_AMOUNT::type::value_type>
|
||||
getAmount() const
|
||||
{
|
||||
if (hasAmount())
|
||||
{
|
||||
return this->tx_.at(sfAmount);
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasAmount() const
|
||||
{
|
||||
return this->tx_.isFieldPresent(sfAmount);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfDestination (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_ACCOUNT::type::value_type>
|
||||
getDestination() const
|
||||
{
|
||||
if (hasDestination())
|
||||
{
|
||||
return this->tx_.at(sfDestination);
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasDestination() const
|
||||
{
|
||||
return this->tx_.isFieldPresent(sfDestination);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfExpiration (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT32::type::value_type>
|
||||
getExpiration() const
|
||||
{
|
||||
if (hasExpiration())
|
||||
{
|
||||
return this->tx_.at(sfExpiration);
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasExpiration() const
|
||||
{
|
||||
return this->tx_.isFieldPresent(sfExpiration);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Builder for NFTokenMint transactions.
|
||||
* Provides a fluent interface for constructing transactions with method chaining.
|
||||
* Uses Json::Value internally for flexible transaction construction.
|
||||
* Inherits common field setters from TransactionBuilderBase.
|
||||
*/
|
||||
class NFTokenMintBuilder : public TransactionBuilderBase<NFTokenMintBuilder>
|
||||
{
|
||||
public:
|
||||
NFTokenMintBuilder(SF_ACCOUNT::type::value_type account,
|
||||
std::decay_t<typename SF_UINT32::type::value_type> const& nFTokenTaxon, std::optional<SF_UINT32::type::value_type> sequence = std::nullopt,
|
||||
std::optional<SF_AMOUNT::type::value_type> fee = std::nullopt
|
||||
)
|
||||
: TransactionBuilderBase<NFTokenMintBuilder>(ttNFTOKEN_MINT, account, sequence, fee)
|
||||
{
|
||||
setNFTokenTaxon(nFTokenTaxon);
|
||||
}
|
||||
|
||||
NFTokenMintBuilder(STTx const& tx)
|
||||
{
|
||||
if (tx.getTxnType() != ttNFTOKEN_MINT)
|
||||
{
|
||||
throw std::runtime_error("Invalid transaction type for NFTokenMintBuilder");
|
||||
}
|
||||
object_ = tx;
|
||||
}
|
||||
|
||||
// Transaction-specific field setters
|
||||
|
||||
/**
|
||||
* Set sfNFTokenTaxon (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
NFTokenMintBuilder&
|
||||
setNFTokenTaxon(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfNFTokenTaxon] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfTransferFee (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
NFTokenMintBuilder&
|
||||
setTransferFee(std::decay_t<typename SF_UINT16::type::value_type> const& value)
|
||||
{
|
||||
object_[sfTransferFee] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfIssuer (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
NFTokenMintBuilder&
|
||||
setIssuer(std::decay_t<typename SF_ACCOUNT::type::value_type> const& value)
|
||||
{
|
||||
object_[sfIssuer] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfURI (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
NFTokenMintBuilder&
|
||||
setURI(std::decay_t<typename SF_VL::type::value_type> const& value)
|
||||
{
|
||||
object_[sfURI] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfAmount (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
NFTokenMintBuilder&
|
||||
setAmount(std::decay_t<typename SF_AMOUNT::type::value_type> const& value)
|
||||
{
|
||||
object_[sfAmount] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfDestination (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
NFTokenMintBuilder&
|
||||
setDestination(std::decay_t<typename SF_ACCOUNT::type::value_type> const& value)
|
||||
{
|
||||
object_[sfDestination] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfExpiration (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
NFTokenMintBuilder&
|
||||
setExpiration(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfExpiration] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build and return the completed NFTokenMint wrapper.
|
||||
* @return The constructed transaction wrapper.
|
||||
* @throws std::runtime_error if the JSON cannot be parsed into a valid transaction.
|
||||
*/
|
||||
NFTokenMint
|
||||
build()
|
||||
{
|
||||
return NFTokenMint(STTx(std::move(object_)));
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::transactions
|
||||
@@ -1,176 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STTx.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/TransactionBase.h>
|
||||
#include <xrpl/protocol_autogen/TransactionBuilderBase.h>
|
||||
#include <xrpl/json/json_value.h>
|
||||
|
||||
#include <stdexcept>
|
||||
#include <optional>
|
||||
|
||||
namespace xrpl::transactions {
|
||||
|
||||
// Forward declaration
|
||||
class NFTokenModifyBuilder;
|
||||
|
||||
/**
|
||||
* Transaction: NFTokenModify
|
||||
* Type: ttNFTOKEN_MODIFY (61)
|
||||
* Delegable: Delegation::delegable
|
||||
* Amendment: featureDynamicNFT
|
||||
* Privileges: noPriv
|
||||
*
|
||||
* Immutable wrapper around STTx providing type-safe field access.
|
||||
* Use NFTokenModifyBuilder to construct new transactions.
|
||||
*/
|
||||
class NFTokenModify : public TransactionBase
|
||||
{
|
||||
public:
|
||||
static constexpr xrpl::TxType txType = ttNFTOKEN_MODIFY;
|
||||
|
||||
/**
|
||||
* Construct a NFTokenModify transaction wrapper from an existing STTx object.
|
||||
* @throws std::runtime_error if the transaction type doesn't match.
|
||||
*/
|
||||
explicit NFTokenModify(STTx const& tx)
|
||||
: TransactionBase(tx)
|
||||
{
|
||||
// Verify transaction type
|
||||
if (tx.getTxnType() != txType)
|
||||
{
|
||||
throw std::runtime_error("Invalid transaction type for NFTokenModify");
|
||||
}
|
||||
}
|
||||
|
||||
// Transaction-specific field getters
|
||||
|
||||
/**
|
||||
* Get sfNFTokenID (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT256::type::value_type
|
||||
getNFTokenID() const
|
||||
{
|
||||
return this->tx_.at(sfNFTokenID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfOwner (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_ACCOUNT::type::value_type>
|
||||
getOwner() const
|
||||
{
|
||||
if (hasOwner())
|
||||
{
|
||||
return this->tx_.at(sfOwner);
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasOwner() const
|
||||
{
|
||||
return this->tx_.isFieldPresent(sfOwner);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfURI (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_VL::type::value_type>
|
||||
getURI() const
|
||||
{
|
||||
if (hasURI())
|
||||
{
|
||||
return this->tx_.at(sfURI);
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasURI() const
|
||||
{
|
||||
return this->tx_.isFieldPresent(sfURI);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Builder for NFTokenModify transactions.
|
||||
* Provides a fluent interface for constructing transactions with method chaining.
|
||||
* Uses Json::Value internally for flexible transaction construction.
|
||||
* Inherits common field setters from TransactionBuilderBase.
|
||||
*/
|
||||
class NFTokenModifyBuilder : public TransactionBuilderBase<NFTokenModifyBuilder>
|
||||
{
|
||||
public:
|
||||
NFTokenModifyBuilder(SF_ACCOUNT::type::value_type account,
|
||||
std::decay_t<typename SF_UINT256::type::value_type> const& nFTokenID, std::optional<SF_UINT32::type::value_type> sequence = std::nullopt,
|
||||
std::optional<SF_AMOUNT::type::value_type> fee = std::nullopt
|
||||
)
|
||||
: TransactionBuilderBase<NFTokenModifyBuilder>(ttNFTOKEN_MODIFY, account, sequence, fee)
|
||||
{
|
||||
setNFTokenID(nFTokenID);
|
||||
}
|
||||
|
||||
NFTokenModifyBuilder(STTx const& tx)
|
||||
{
|
||||
if (tx.getTxnType() != ttNFTOKEN_MODIFY)
|
||||
{
|
||||
throw std::runtime_error("Invalid transaction type for NFTokenModifyBuilder");
|
||||
}
|
||||
object_ = tx;
|
||||
}
|
||||
|
||||
// Transaction-specific field setters
|
||||
|
||||
/**
|
||||
* Set sfNFTokenID (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
NFTokenModifyBuilder&
|
||||
setNFTokenID(std::decay_t<typename SF_UINT256::type::value_type> const& value)
|
||||
{
|
||||
object_[sfNFTokenID] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfOwner (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
NFTokenModifyBuilder&
|
||||
setOwner(std::decay_t<typename SF_ACCOUNT::type::value_type> const& value)
|
||||
{
|
||||
object_[sfOwner] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfURI (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
NFTokenModifyBuilder&
|
||||
setURI(std::decay_t<typename SF_VL::type::value_type> const& value)
|
||||
{
|
||||
object_[sfURI] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build and return the completed NFTokenModify wrapper.
|
||||
* @return The constructed transaction wrapper.
|
||||
* @throws std::runtime_error if the JSON cannot be parsed into a valid transaction.
|
||||
*/
|
||||
NFTokenModify
|
||||
build()
|
||||
{
|
||||
return NFTokenModify(STTx(std::move(object_)));
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::transactions
|
||||
@@ -1,112 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STTx.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/TransactionBase.h>
|
||||
#include <xrpl/protocol_autogen/TransactionBuilderBase.h>
|
||||
#include <xrpl/json/json_value.h>
|
||||
|
||||
#include <stdexcept>
|
||||
#include <optional>
|
||||
|
||||
namespace xrpl::transactions {
|
||||
|
||||
// Forward declaration
|
||||
class OfferCancelBuilder;
|
||||
|
||||
/**
|
||||
* Transaction: OfferCancel
|
||||
* Type: ttOFFER_CANCEL (8)
|
||||
* Delegable: Delegation::delegable
|
||||
* Amendment: uint256{}
|
||||
* Privileges: noPriv
|
||||
*
|
||||
* Immutable wrapper around STTx providing type-safe field access.
|
||||
* Use OfferCancelBuilder to construct new transactions.
|
||||
*/
|
||||
class OfferCancel : public TransactionBase
|
||||
{
|
||||
public:
|
||||
static constexpr xrpl::TxType txType = ttOFFER_CANCEL;
|
||||
|
||||
/**
|
||||
* Construct a OfferCancel transaction wrapper from an existing STTx object.
|
||||
* @throws std::runtime_error if the transaction type doesn't match.
|
||||
*/
|
||||
explicit OfferCancel(STTx const& tx)
|
||||
: TransactionBase(tx)
|
||||
{
|
||||
// Verify transaction type
|
||||
if (tx.getTxnType() != txType)
|
||||
{
|
||||
throw std::runtime_error("Invalid transaction type for OfferCancel");
|
||||
}
|
||||
}
|
||||
|
||||
// Transaction-specific field getters
|
||||
|
||||
/**
|
||||
* Get sfOfferSequence (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT32::type::value_type
|
||||
getOfferSequence() const
|
||||
{
|
||||
return this->tx_.at(sfOfferSequence);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Builder for OfferCancel transactions.
|
||||
* Provides a fluent interface for constructing transactions with method chaining.
|
||||
* Uses Json::Value internally for flexible transaction construction.
|
||||
* Inherits common field setters from TransactionBuilderBase.
|
||||
*/
|
||||
class OfferCancelBuilder : public TransactionBuilderBase<OfferCancelBuilder>
|
||||
{
|
||||
public:
|
||||
OfferCancelBuilder(SF_ACCOUNT::type::value_type account,
|
||||
std::decay_t<typename SF_UINT32::type::value_type> const& offerSequence, std::optional<SF_UINT32::type::value_type> sequence = std::nullopt,
|
||||
std::optional<SF_AMOUNT::type::value_type> fee = std::nullopt
|
||||
)
|
||||
: TransactionBuilderBase<OfferCancelBuilder>(ttOFFER_CANCEL, account, sequence, fee)
|
||||
{
|
||||
setOfferSequence(offerSequence);
|
||||
}
|
||||
|
||||
OfferCancelBuilder(STTx const& tx)
|
||||
{
|
||||
if (tx.getTxnType() != ttOFFER_CANCEL)
|
||||
{
|
||||
throw std::runtime_error("Invalid transaction type for OfferCancelBuilder");
|
||||
}
|
||||
object_ = tx;
|
||||
}
|
||||
|
||||
// Transaction-specific field setters
|
||||
|
||||
/**
|
||||
* Set sfOfferSequence (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
OfferCancelBuilder&
|
||||
setOfferSequence(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfOfferSequence] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build and return the completed OfferCancel wrapper.
|
||||
* @return The constructed transaction wrapper.
|
||||
* @throws std::runtime_error if the JSON cannot be parsed into a valid transaction.
|
||||
*/
|
||||
OfferCancel
|
||||
build()
|
||||
{
|
||||
return OfferCancel(STTx(std::move(object_)));
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::transactions
|
||||
@@ -1,230 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STTx.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/TransactionBase.h>
|
||||
#include <xrpl/protocol_autogen/TransactionBuilderBase.h>
|
||||
#include <xrpl/json/json_value.h>
|
||||
|
||||
#include <stdexcept>
|
||||
#include <optional>
|
||||
|
||||
namespace xrpl::transactions {
|
||||
|
||||
// Forward declaration
|
||||
class OfferCreateBuilder;
|
||||
|
||||
/**
|
||||
* Transaction: OfferCreate
|
||||
* Type: ttOFFER_CREATE (7)
|
||||
* Delegable: Delegation::delegable
|
||||
* Amendment: uint256{}
|
||||
* Privileges: noPriv
|
||||
*
|
||||
* Immutable wrapper around STTx providing type-safe field access.
|
||||
* Use OfferCreateBuilder to construct new transactions.
|
||||
*/
|
||||
class OfferCreate : public TransactionBase
|
||||
{
|
||||
public:
|
||||
static constexpr xrpl::TxType txType = ttOFFER_CREATE;
|
||||
|
||||
/**
|
||||
* Construct a OfferCreate transaction wrapper from an existing STTx object.
|
||||
* @throws std::runtime_error if the transaction type doesn't match.
|
||||
*/
|
||||
explicit OfferCreate(STTx const& tx)
|
||||
: TransactionBase(tx)
|
||||
{
|
||||
// Verify transaction type
|
||||
if (tx.getTxnType() != txType)
|
||||
{
|
||||
throw std::runtime_error("Invalid transaction type for OfferCreate");
|
||||
}
|
||||
}
|
||||
|
||||
// Transaction-specific field getters
|
||||
|
||||
/**
|
||||
* Get sfTakerPays (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_AMOUNT::type::value_type
|
||||
getTakerPays() const
|
||||
{
|
||||
return this->tx_.at(sfTakerPays);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfTakerGets (soeREQUIRED)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_AMOUNT::type::value_type
|
||||
getTakerGets() const
|
||||
{
|
||||
return this->tx_.at(sfTakerGets);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfExpiration (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT32::type::value_type>
|
||||
getExpiration() const
|
||||
{
|
||||
if (hasExpiration())
|
||||
{
|
||||
return this->tx_.at(sfExpiration);
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasExpiration() const
|
||||
{
|
||||
return this->tx_.isFieldPresent(sfExpiration);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfOfferSequence (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT32::type::value_type>
|
||||
getOfferSequence() const
|
||||
{
|
||||
if (hasOfferSequence())
|
||||
{
|
||||
return this->tx_.at(sfOfferSequence);
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasOfferSequence() const
|
||||
{
|
||||
return this->tx_.isFieldPresent(sfOfferSequence);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sfDomainID (soeOPTIONAL)
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT256::type::value_type>
|
||||
getDomainID() const
|
||||
{
|
||||
if (hasDomainID())
|
||||
{
|
||||
return this->tx_.at(sfDomainID);
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasDomainID() const
|
||||
{
|
||||
return this->tx_.isFieldPresent(sfDomainID);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Builder for OfferCreate transactions.
|
||||
* Provides a fluent interface for constructing transactions with method chaining.
|
||||
* Uses Json::Value internally for flexible transaction construction.
|
||||
* Inherits common field setters from TransactionBuilderBase.
|
||||
*/
|
||||
class OfferCreateBuilder : public TransactionBuilderBase<OfferCreateBuilder>
|
||||
{
|
||||
public:
|
||||
OfferCreateBuilder(SF_ACCOUNT::type::value_type account,
|
||||
std::decay_t<typename SF_AMOUNT::type::value_type> const& takerPays, std::decay_t<typename SF_AMOUNT::type::value_type> const& takerGets, std::optional<SF_UINT32::type::value_type> sequence = std::nullopt,
|
||||
std::optional<SF_AMOUNT::type::value_type> fee = std::nullopt
|
||||
)
|
||||
: TransactionBuilderBase<OfferCreateBuilder>(ttOFFER_CREATE, account, sequence, fee)
|
||||
{
|
||||
setTakerPays(takerPays);
|
||||
setTakerGets(takerGets);
|
||||
}
|
||||
|
||||
OfferCreateBuilder(STTx const& tx)
|
||||
{
|
||||
if (tx.getTxnType() != ttOFFER_CREATE)
|
||||
{
|
||||
throw std::runtime_error("Invalid transaction type for OfferCreateBuilder");
|
||||
}
|
||||
object_ = tx;
|
||||
}
|
||||
|
||||
// Transaction-specific field setters
|
||||
|
||||
/**
|
||||
* Set sfTakerPays (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
OfferCreateBuilder&
|
||||
setTakerPays(std::decay_t<typename SF_AMOUNT::type::value_type> const& value)
|
||||
{
|
||||
object_[sfTakerPays] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfTakerGets (soeREQUIRED)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
OfferCreateBuilder&
|
||||
setTakerGets(std::decay_t<typename SF_AMOUNT::type::value_type> const& value)
|
||||
{
|
||||
object_[sfTakerGets] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfExpiration (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
OfferCreateBuilder&
|
||||
setExpiration(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfExpiration] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfOfferSequence (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
OfferCreateBuilder&
|
||||
setOfferSequence(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfOfferSequence] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sfDomainID (soeOPTIONAL)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
OfferCreateBuilder&
|
||||
setDomainID(std::decay_t<typename SF_UINT256::type::value_type> const& value)
|
||||
{
|
||||
object_[sfDomainID] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build and return the completed OfferCreate wrapper.
|
||||
* @return The constructed transaction wrapper.
|
||||
* @throws std::runtime_error if the JSON cannot be parsed into a valid transaction.
|
||||
*/
|
||||
OfferCreate
|
||||
build()
|
||||
{
|
||||
return OfferCreate(STTx(std::move(object_)));
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::transactions
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user