mirror of
https://github.com/XRPLF/rippled.git
synced 2026-03-06 21:02:27 +00:00
Compare commits
168 Commits
a1q123456/
...
ripple/was
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9c25d18851 | ||
|
|
3a825a41e1 | ||
|
|
a9ebf786c6 | ||
|
|
5afe8cc321 | ||
|
|
bc5ec3c962 | ||
|
|
1775251e90 | ||
|
|
61bcb7621f | ||
|
|
a3f71b1774 | ||
|
|
4df7d1a4bb | ||
|
|
125df7a425 | ||
|
|
b08bcf5d21 | ||
|
|
dc413aef0c | ||
|
|
77dfd56ace | ||
|
|
953b9a3500 | ||
|
|
1d9ec84350 | ||
|
|
0392846a17 | ||
|
|
1b4a564369 | ||
|
|
fd524c4be9 | ||
|
|
495dda7f58 | ||
|
|
9c3c0280b1 | ||
|
|
f73d8a6cf2 | ||
|
|
6728ab52b7 | ||
|
|
77673663ca | ||
|
|
c1381f8ddd | ||
|
|
bd16f7989d | ||
|
|
65f9cf80c0 | ||
|
|
de55a5ebfc | ||
|
|
2ec4a1114e | ||
|
|
ba03a8a9d2 | ||
|
|
7c8279ec83 | ||
|
|
0418ffb26a | ||
|
|
b2627039f6 | ||
|
|
8f97ec3bde | ||
|
|
e85e7b1b1a | ||
|
|
803a344c65 | ||
|
|
4eb34f381a | ||
|
|
72fffb6e51 | ||
|
|
f7ee580f01 | ||
|
|
122d405750 | ||
|
|
c1c1b4ea67 | ||
|
|
977caea0a5 | ||
|
|
d7ed6d6512 | ||
|
|
f1f2e2629f | ||
|
|
917c610f96 | ||
|
|
317e533d81 | ||
|
|
4160677878 | ||
|
|
df98db1452 | ||
|
|
673476ef1b | ||
|
|
8bc6f9cd70 | ||
|
|
ba5debfecd | ||
|
|
f4a27c9b6d | ||
|
|
fd1cb318e3 | ||
|
|
8c3544a58c | ||
|
|
ed5139d4e3 | ||
|
|
42494dd4cf | ||
|
|
ce84cc8b44 | ||
|
|
9a9a7aab01 | ||
|
|
209a1a6ffa | ||
|
|
fc35a9f9c8 | ||
|
|
c5e50aa221 | ||
|
|
074b1f00d5 | ||
|
|
7a9d245950 | ||
|
|
1809fe07f2 | ||
|
|
409c67494a | ||
|
|
c626b6403a | ||
|
|
81cbc91927 | ||
|
|
1c812a6c4d | ||
|
|
0724927799 | ||
|
|
d83ec96848 | ||
|
|
375dd50b35 | ||
|
|
419d53ec4c | ||
|
|
d4d70d5675 | ||
|
|
6ab15f8377 | ||
|
|
91f3d51f3d | ||
|
|
9ed60b45f8 | ||
|
|
d5c53dcfd2 | ||
|
|
e94321fb41 | ||
|
|
bbc28b3b1c | ||
|
|
843e981c8a | ||
|
|
5aab274b7a | ||
|
|
2c30e41191 | ||
|
|
8ea5106b0b | ||
|
|
f57f67a8ae | ||
|
|
a98269f049 | ||
|
|
b66bc47ca9 | ||
|
|
0e9c7458bb | ||
|
|
1d89940653 | ||
|
|
1a1a6806ec | ||
|
|
1977df9c2e | ||
|
|
6c95548df5 | ||
|
|
69ab39d658 | ||
|
|
b9eb66eecc | ||
|
|
881087dd3d | ||
|
|
90e0bbd0fc | ||
|
|
b57df290de | ||
|
|
8a403f1241 | ||
|
|
6d2640871d | ||
|
|
c145598ff9 | ||
|
|
50e5608d86 | ||
|
|
7a7b96107c | ||
|
|
500bb68831 | ||
|
|
53eb0f60bc | ||
|
|
41205ae928 | ||
|
|
c33b0ae463 | ||
|
|
16087c9680 | ||
|
|
56bc6d58f6 | ||
|
|
ef5d335e09 | ||
|
|
25c3060fef | ||
|
|
ce9f0b38a4 | ||
|
|
35f7cbf772 | ||
|
|
0db564d261 | ||
|
|
427b7ea104 | ||
|
|
7bf6878b4b | ||
|
|
0bc1a115ff | ||
|
|
334bcfa5ef | ||
|
|
106dea4559 | ||
|
|
3ffdcf8114 | ||
|
|
4021a7eb28 | ||
|
|
0690fda0f1 | ||
|
|
d0cc48c6d3 | ||
|
|
d66e3c949e | ||
|
|
0c65a386b5 | ||
|
|
29f5430881 | ||
|
|
101f285bcd | ||
|
|
286dc6322b | ||
|
|
c9346cd40d | ||
|
|
1c5683ec78 | ||
|
|
9bee155d59 | ||
|
|
f34b05f4de | ||
|
|
97ce25f4ce | ||
|
|
9e14c14a26 | ||
|
|
c507880d8f | ||
|
|
3f8328bbf8 | ||
|
|
c10a5f9ef6 | ||
|
|
3c141de695 | ||
|
|
da2b9455f2 | ||
|
|
cb622488c0 | ||
|
|
32f971fec6 | ||
|
|
8dea76baa4 | ||
|
|
299fbe04c4 | ||
|
|
57fc1df7d7 | ||
|
|
eaba76f9e6 | ||
|
|
cb702cc238 | ||
|
|
b69b4a0a4a | ||
|
|
50d6072a73 | ||
|
|
d24cd50e61 | ||
|
|
9f5875158c | ||
|
|
c3dc33c861 | ||
|
|
6be8f2124c | ||
|
|
edfed06001 | ||
|
|
1c646dba91 | ||
|
|
6781068058 | ||
|
|
cfe57c1dfe | ||
|
|
c34d09a971 | ||
|
|
ebd90c4742 | ||
|
|
ba52d34828 | ||
|
|
1b6312afb3 | ||
|
|
bf32dc2e72 | ||
|
|
a15d65f7a2 | ||
|
|
2de8488855 | ||
|
|
129aa4bfaa | ||
|
|
b1d70db63b | ||
|
|
f03c3aafe4 | ||
|
|
51a9f106d1 | ||
|
|
bfc048e3fe | ||
|
|
83418644f7 | ||
|
|
dbc9dd5bfc | ||
|
|
45ab15d4b5 |
247
.cmake-format.yaml
Normal file
247
.cmake-format.yaml
Normal file
@@ -0,0 +1,247 @@
|
||||
_help_parse: Options affecting listfile parsing
|
||||
parse:
|
||||
_help_additional_commands:
|
||||
- Specify structure for custom cmake functions
|
||||
additional_commands:
|
||||
target_protobuf_sources:
|
||||
pargs:
|
||||
- target
|
||||
- prefix
|
||||
kwargs:
|
||||
PROTOS: "*"
|
||||
LANGUAGE: cpp
|
||||
IMPORT_DIRS: "*"
|
||||
GENERATE_EXTENSIONS: "*"
|
||||
PLUGIN: "*"
|
||||
_help_override_spec:
|
||||
- Override configurations per-command where available
|
||||
override_spec: {}
|
||||
_help_vartags:
|
||||
- Specify variable tags.
|
||||
vartags: []
|
||||
_help_proptags:
|
||||
- Specify property tags.
|
||||
proptags: []
|
||||
_help_format: Options affecting formatting.
|
||||
format:
|
||||
_help_disable:
|
||||
- Disable formatting entirely, making cmake-format a no-op
|
||||
disable: false
|
||||
_help_line_width:
|
||||
- How wide to allow formatted cmake files
|
||||
line_width: 100
|
||||
_help_tab_size:
|
||||
- How many spaces to tab for indent
|
||||
tab_size: 4
|
||||
_help_use_tabchars:
|
||||
- If true, lines are indented using tab characters (utf-8
|
||||
- 0x09) instead of <tab_size> space characters (utf-8 0x20).
|
||||
- In cases where the layout would require a fractional tab
|
||||
- character, the behavior of the fractional indentation is
|
||||
- governed by <fractional_tab_policy>
|
||||
use_tabchars: false
|
||||
_help_fractional_tab_policy:
|
||||
- If <use_tabchars> is True, then the value of this variable
|
||||
- indicates how fractional indentions are handled during
|
||||
- whitespace replacement. If set to 'use-space', fractional
|
||||
- indentation is left as spaces (utf-8 0x20). If set to
|
||||
- "`round-up` fractional indentation is replaced with a single"
|
||||
- tab character (utf-8 0x09) effectively shifting the column
|
||||
- to the next tabstop
|
||||
fractional_tab_policy: use-space
|
||||
_help_max_subgroups_hwrap:
|
||||
- If an argument group contains more than this many sub-groups
|
||||
- (parg or kwarg groups) then force it to a vertical layout.
|
||||
max_subgroups_hwrap: 4
|
||||
_help_max_pargs_hwrap:
|
||||
- If a positional argument group contains more than this many
|
||||
- arguments, then force it to a vertical layout.
|
||||
max_pargs_hwrap: 5
|
||||
_help_max_rows_cmdline:
|
||||
- If a cmdline positional group consumes more than this many
|
||||
- lines without nesting, then invalidate the layout (and nest)
|
||||
max_rows_cmdline: 2
|
||||
_help_separate_ctrl_name_with_space:
|
||||
- If true, separate flow control names from their parentheses
|
||||
- with a space
|
||||
separate_ctrl_name_with_space: true
|
||||
_help_separate_fn_name_with_space:
|
||||
- If true, separate function names from parentheses with a
|
||||
- space
|
||||
separate_fn_name_with_space: false
|
||||
_help_dangle_parens:
|
||||
- If a statement is wrapped to more than one line, than dangle
|
||||
- the closing parenthesis on its own line.
|
||||
dangle_parens: false
|
||||
_help_dangle_align:
|
||||
- If the trailing parenthesis must be 'dangled' on its on
|
||||
- "line, then align it to this reference: `prefix`: the start"
|
||||
- "of the statement, `prefix-indent`: the start of the"
|
||||
- "statement, plus one indentation level, `child`: align to"
|
||||
- the column of the arguments
|
||||
dangle_align: prefix
|
||||
_help_min_prefix_chars:
|
||||
- If the statement spelling length (including space and
|
||||
- parenthesis) is smaller than this amount, then force reject
|
||||
- nested layouts.
|
||||
min_prefix_chars: 18
|
||||
_help_max_prefix_chars:
|
||||
- If the statement spelling length (including space and
|
||||
- parenthesis) is larger than the tab width by more than this
|
||||
- amount, then force reject un-nested layouts.
|
||||
max_prefix_chars: 10
|
||||
_help_max_lines_hwrap:
|
||||
- If a candidate layout is wrapped horizontally but it exceeds
|
||||
- this many lines, then reject the layout.
|
||||
max_lines_hwrap: 2
|
||||
_help_line_ending:
|
||||
- What style line endings to use in the output.
|
||||
line_ending: unix
|
||||
_help_command_case:
|
||||
- Format command names consistently as 'lower' or 'upper' case
|
||||
command_case: canonical
|
||||
_help_keyword_case:
|
||||
- Format keywords consistently as 'lower' or 'upper' case
|
||||
keyword_case: unchanged
|
||||
_help_always_wrap:
|
||||
- A list of command names which should always be wrapped
|
||||
always_wrap: []
|
||||
_help_enable_sort:
|
||||
- If true, the argument lists which are known to be sortable
|
||||
- will be sorted lexicographicall
|
||||
enable_sort: true
|
||||
_help_autosort:
|
||||
- If true, the parsers may infer whether or not an argument
|
||||
- list is sortable (without annotation).
|
||||
autosort: true
|
||||
_help_require_valid_layout:
|
||||
- By default, if cmake-format cannot successfully fit
|
||||
- everything into the desired linewidth it will apply the
|
||||
- last, most aggressive attempt that it made. If this flag is
|
||||
- True, however, cmake-format will print error, exit with non-
|
||||
- zero status code, and write-out nothing
|
||||
require_valid_layout: false
|
||||
_help_layout_passes:
|
||||
- A dictionary mapping layout nodes to a list of wrap
|
||||
- decisions. See the documentation for more information.
|
||||
layout_passes: {}
|
||||
_help_markup: Options affecting comment reflow and formatting.
|
||||
markup:
|
||||
_help_bullet_char:
|
||||
- What character to use for bulleted lists
|
||||
bullet_char: "-"
|
||||
_help_enum_char:
|
||||
- What character to use as punctuation after numerals in an
|
||||
- enumerated list
|
||||
enum_char: .
|
||||
_help_first_comment_is_literal:
|
||||
- If comment markup is enabled, don't reflow the first comment
|
||||
- block in each listfile. Use this to preserve formatting of
|
||||
- your copyright/license statements.
|
||||
first_comment_is_literal: false
|
||||
_help_literal_comment_pattern:
|
||||
- If comment markup is enabled, don't reflow any comment block
|
||||
- which matches this (regex) pattern. Default is `None`
|
||||
- (disabled).
|
||||
literal_comment_pattern: null
|
||||
_help_fence_pattern:
|
||||
- Regular expression to match preformat fences in comments
|
||||
- default= ``r'^\s*([`~]{3}[`~]*)(.*)$'``
|
||||
fence_pattern: ^\s*([`~]{3}[`~]*)(.*)$
|
||||
_help_ruler_pattern:
|
||||
- Regular expression to match rulers in comments default=
|
||||
- '``r''^\s*[^\w\s]{3}.*[^\w\s]{3}$''``'
|
||||
ruler_pattern: ^\s*[^\w\s]{3}.*[^\w\s]{3}$
|
||||
_help_explicit_trailing_pattern:
|
||||
- If a comment line matches starts with this pattern then it
|
||||
- is explicitly a trailing comment for the preceding
|
||||
- argument. Default is '#<'
|
||||
explicit_trailing_pattern: "#<"
|
||||
_help_hashruler_min_length:
|
||||
- If a comment line starts with at least this many consecutive
|
||||
- hash characters, then don't lstrip() them off. This allows
|
||||
- for lazy hash rulers where the first hash char is not
|
||||
- separated by space
|
||||
hashruler_min_length: 10
|
||||
_help_canonicalize_hashrulers:
|
||||
- If true, then insert a space between the first hash char and
|
||||
- remaining hash chars in a hash ruler, and normalize its
|
||||
- length to fill the column
|
||||
canonicalize_hashrulers: true
|
||||
_help_enable_markup:
|
||||
- enable comment markup parsing and reflow
|
||||
enable_markup: false
|
||||
_help_lint: Options affecting the linter
|
||||
lint:
|
||||
_help_disabled_codes:
|
||||
- a list of lint codes to disable
|
||||
disabled_codes: []
|
||||
_help_function_pattern:
|
||||
- regular expression pattern describing valid function names
|
||||
function_pattern: "[0-9a-z_]+"
|
||||
_help_macro_pattern:
|
||||
- regular expression pattern describing valid macro names
|
||||
macro_pattern: "[0-9A-Z_]+"
|
||||
_help_global_var_pattern:
|
||||
- regular expression pattern describing valid names for
|
||||
- variables with global (cache) scope
|
||||
global_var_pattern: "[A-Z][0-9A-Z_]+"
|
||||
_help_internal_var_pattern:
|
||||
- regular expression pattern describing valid names for
|
||||
- variables with global scope (but internal semantic)
|
||||
internal_var_pattern: _[A-Z][0-9A-Z_]+
|
||||
_help_local_var_pattern:
|
||||
- regular expression pattern describing valid names for
|
||||
- variables with local scope
|
||||
local_var_pattern: "[a-z][a-z0-9_]+"
|
||||
_help_private_var_pattern:
|
||||
- regular expression pattern describing valid names for
|
||||
- privatedirectory variables
|
||||
private_var_pattern: _[0-9a-z_]+
|
||||
_help_public_var_pattern:
|
||||
- regular expression pattern describing valid names for public
|
||||
- directory variables
|
||||
public_var_pattern: "[A-Z][0-9A-Z_]+"
|
||||
_help_argument_var_pattern:
|
||||
- regular expression pattern describing valid names for
|
||||
- function/macro arguments and loop variables.
|
||||
argument_var_pattern: "[a-z][a-z0-9_]+"
|
||||
_help_keyword_pattern:
|
||||
- regular expression pattern describing valid names for
|
||||
- keywords used in functions or macros
|
||||
keyword_pattern: "[A-Z][0-9A-Z_]+"
|
||||
_help_max_conditionals_custom_parser:
|
||||
- In the heuristic for C0201, how many conditionals to match
|
||||
- within a loop in before considering the loop a parser.
|
||||
max_conditionals_custom_parser: 2
|
||||
_help_min_statement_spacing:
|
||||
- Require at least this many newlines between statements
|
||||
min_statement_spacing: 1
|
||||
_help_max_statement_spacing:
|
||||
- Require no more than this many newlines between statements
|
||||
max_statement_spacing: 2
|
||||
max_returns: 6
|
||||
max_branches: 12
|
||||
max_arguments: 5
|
||||
max_localvars: 15
|
||||
max_statements: 50
|
||||
_help_encode: Options affecting file encoding
|
||||
encode:
|
||||
_help_emit_byteorder_mark:
|
||||
- If true, emit the unicode byte-order mark (BOM) at the start
|
||||
- of the file
|
||||
emit_byteorder_mark: false
|
||||
_help_input_encoding:
|
||||
- Specify the encoding of the input file. Defaults to utf-8
|
||||
input_encoding: utf-8
|
||||
_help_output_encoding:
|
||||
- Specify the encoding of the output file. Defaults to utf-8.
|
||||
- Note that cmake only claims to support utf-8 so be careful
|
||||
- when using anything else
|
||||
output_encoding: utf-8
|
||||
_help_misc: Miscellaneous configurations options.
|
||||
misc:
|
||||
_help_per_command:
|
||||
- A dictionary containing any per-command configuration
|
||||
- overrides. Currently only `command_case` is supported.
|
||||
per_command: {}
|
||||
@@ -1,101 +0,0 @@
|
||||
# Custom CMake command definitions for gersemi formatting.
|
||||
# These stubs teach gersemi the signatures of project-specific commands
|
||||
# so it can format their invocations correctly.
|
||||
|
||||
function(git_branch branch_val)
|
||||
endfunction()
|
||||
|
||||
function(isolate_headers target A B scope)
|
||||
endfunction()
|
||||
|
||||
function(create_symbolic_link target link)
|
||||
endfunction()
|
||||
|
||||
function(xrpl_add_test name)
|
||||
endfunction()
|
||||
|
||||
macro(exclude_from_default target_)
|
||||
endmacro()
|
||||
|
||||
macro(exclude_if_included target_)
|
||||
endmacro()
|
||||
|
||||
function(target_protobuf_sources target prefix)
|
||||
set(options APPEND_PATH DESCRIPTORS)
|
||||
set(oneValueArgs
|
||||
LANGUAGE
|
||||
OUT_VAR
|
||||
EXPORT_MACRO
|
||||
TARGET
|
||||
PROTOC_OUT_DIR
|
||||
PLUGIN
|
||||
PLUGIN_OPTIONS
|
||||
PROTOC_EXE
|
||||
)
|
||||
set(multiValueArgs
|
||||
PROTOS
|
||||
IMPORT_DIRS
|
||||
GENERATE_EXTENSIONS
|
||||
PROTOC_OPTIONS
|
||||
DEPENDENCIES
|
||||
)
|
||||
cmake_parse_arguments(
|
||||
THIS_FUNCTION_PREFIX
|
||||
"${options}"
|
||||
"${oneValueArgs}"
|
||||
"${multiValueArgs}"
|
||||
${ARGN}
|
||||
)
|
||||
endfunction()
|
||||
|
||||
function(add_module parent name)
|
||||
endfunction()
|
||||
|
||||
function(setup_protocol_autogen)
|
||||
endfunction()
|
||||
|
||||
function(target_link_modules parent scope)
|
||||
endfunction()
|
||||
|
||||
function(setup_target_for_coverage_gcovr)
|
||||
set(options NONE)
|
||||
set(oneValueArgs BASE_DIRECTORY NAME FORMAT)
|
||||
set(multiValueArgs EXCLUDE EXECUTABLE EXECUTABLE_ARGS DEPENDENCIES)
|
||||
cmake_parse_arguments(
|
||||
THIS_FUNCTION_PREFIX
|
||||
"${options}"
|
||||
"${oneValueArgs}"
|
||||
"${multiValueArgs}"
|
||||
${ARGN}
|
||||
)
|
||||
endfunction()
|
||||
|
||||
function(add_code_coverage_to_target name scope)
|
||||
endfunction()
|
||||
|
||||
function(verbose_find_path variable name)
|
||||
set(options
|
||||
NO_CACHE
|
||||
REQUIRED
|
||||
OPTIONAL
|
||||
NO_DEFAULT_PATH
|
||||
NO_PACKAGE_ROOT_PATH
|
||||
NO_CMAKE_PATH
|
||||
NO_CMAKE_ENVIRONMENT_PATH
|
||||
NO_SYSTEM_ENVIRONMENT_PATH
|
||||
NO_CMAKE_SYSTEM_PATH
|
||||
NO_CMAKE_INSTALL_PREFIX
|
||||
CMAKE_FIND_ROOT_PATH_BOTH
|
||||
ONLY_CMAKE_FIND_ROOT_PATH
|
||||
NO_CMAKE_FIND_ROOT_PATH
|
||||
)
|
||||
set(oneValueArgs REGISTRY_VIEW VALIDATOR DOC)
|
||||
set(multiValueArgs NAMES HINTS PATHS PATH_SUFFIXES)
|
||||
cmake_parse_arguments(
|
||||
THIS_FUNCTION_PREFIX
|
||||
"${options}"
|
||||
"${oneValueArgs}"
|
||||
"${multiValueArgs}"
|
||||
${ARGN}
|
||||
)
|
||||
endfunction()
|
||||
@@ -1 +0,0 @@
|
||||
definitions: [.gersemi]
|
||||
@@ -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
|
||||
@@ -175,8 +174,6 @@ test.unit_test > xrpl.basics
|
||||
tests.libxrpl > xrpl.basics
|
||||
tests.libxrpl > xrpl.json
|
||||
tests.libxrpl > xrpl.net
|
||||
tests.libxrpl > xrpl.protocol
|
||||
tests.libxrpl > xrpl.protocol_autogen
|
||||
xrpl.conditions > xrpl.basics
|
||||
xrpl.conditions > xrpl.protocol
|
||||
xrpl.core > xrpl.basics
|
||||
@@ -193,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,12 +25,12 @@ repos:
|
||||
- id: clang-format
|
||||
args: [--style=file]
|
||||
"types_or": [c++, c, proto]
|
||||
exclude: ^include/xrpl/protocol_autogen/(transactions|ledger_objects)/
|
||||
|
||||
- repo: https://github.com/BlankSpruce/gersemi
|
||||
rev: 0.26.0
|
||||
- repo: https://github.com/cheshirekow/cmake-format-precommit
|
||||
rev: e2c2116d86a80e72e7146a06e68b7c228afc6319 # frozen: v0.6.13
|
||||
hooks:
|
||||
- id: gersemi
|
||||
- id: cmake-format
|
||||
additional_dependencies: [PyYAML]
|
||||
|
||||
- repo: https://github.com/rbubley/mirrors-prettier
|
||||
rev: c2bc67fe8f8f549cc489e00ba8b45aa18ee713b1 # frozen: v3.8.1
|
||||
@@ -49,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:
|
||||
@@ -81,6 +78,5 @@ repos:
|
||||
exclude: |
|
||||
(?x)^(
|
||||
external/.*|
|
||||
.github/scripts/levelization/results/.*\.txt|
|
||||
src/tests/libxrpl/protocol_autogen/(transactions|ledger_objects)/.*
|
||||
.github/scripts/levelization/results/.*\.txt
|
||||
)$
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
|
||||
if(POLICY CMP0074)
|
||||
if (POLICY CMP0074)
|
||||
cmake_policy(SET CMP0074 NEW)
|
||||
endif()
|
||||
if(POLICY CMP0077)
|
||||
endif ()
|
||||
if (POLICY CMP0077)
|
||||
cmake_policy(SET CMP0077 NEW)
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
# Fix "unrecognized escape" issues when passing CMAKE_MODULE_PATH on Windows.
|
||||
if(DEFINED CMAKE_MODULE_PATH)
|
||||
if (DEFINED CMAKE_MODULE_PATH)
|
||||
file(TO_CMAKE_PATH "${CMAKE_MODULE_PATH}" CMAKE_MODULE_PATH)
|
||||
endif()
|
||||
endif ()
|
||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
||||
|
||||
project(xrpl)
|
||||
@@ -21,64 +21,57 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
|
||||
include(CompilationEnv)
|
||||
|
||||
if(is_gcc)
|
||||
if (is_gcc)
|
||||
# GCC-specific fixes
|
||||
add_compile_options(-Wno-unknown-pragmas -Wno-subobject-linkage)
|
||||
# -Wno-subobject-linkage can be removed when we upgrade GCC version to at least 13.3
|
||||
elseif(is_clang)
|
||||
elseif (is_clang)
|
||||
# Clang-specific fixes
|
||||
add_compile_options(-Wno-unknown-warning-option) # Ignore unknown warning options
|
||||
elseif(is_msvc)
|
||||
elseif (is_msvc)
|
||||
# MSVC-specific fixes
|
||||
add_compile_options(/wd4068) # Ignore unknown pragmas
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
# Enable ccache to speed up builds.
|
||||
include(Ccache)
|
||||
|
||||
if(thread_safety_analysis)
|
||||
add_compile_options(
|
||||
-Wthread-safety
|
||||
-D_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS
|
||||
-DXRPL_ENABLE_THREAD_SAFETY_ANNOTATIONS
|
||||
)
|
||||
if (thread_safety_analysis)
|
||||
add_compile_options(-Wthread-safety -D_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS
|
||||
-DXRPL_ENABLE_THREAD_SAFETY_ANNOTATIONS)
|
||||
add_compile_options("-stdlib=libc++")
|
||||
add_link_options("-stdlib=libc++")
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
include(CheckCXXCompilerFlag)
|
||||
include(FetchContent)
|
||||
include(ExternalProject)
|
||||
include(CMakeFuncs) # must come *after* ExternalProject b/c it overrides one function in EP
|
||||
if(target)
|
||||
message(
|
||||
FATAL_ERROR
|
||||
"The target option has been removed - use native cmake options to control build"
|
||||
if (target)
|
||||
message(FATAL_ERROR "The target option has been removed - use native cmake options to control build"
|
||||
)
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
include(XrplSanity)
|
||||
include(XrplVersion)
|
||||
include(XrplSettings)
|
||||
# this check has to remain in the top-level cmake because of the early return statement
|
||||
if(packages_only)
|
||||
if(NOT TARGET rpm)
|
||||
message(
|
||||
FATAL_ERROR
|
||||
"packages_only requested, but targets were not created - is docker installed?"
|
||||
if (packages_only)
|
||||
if (NOT TARGET rpm)
|
||||
message(FATAL_ERROR "packages_only requested, but targets were not created - is docker installed?"
|
||||
)
|
||||
endif()
|
||||
endif ()
|
||||
return()
|
||||
endif()
|
||||
endif ()
|
||||
include(XrplCompiler)
|
||||
include(XrplSanitizers)
|
||||
include(XrplInterface)
|
||||
|
||||
option(only_docs "Include only the docs target?" FALSE)
|
||||
include(XrplDocs)
|
||||
if(only_docs)
|
||||
if (only_docs)
|
||||
return()
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
include(deps/Boost)
|
||||
|
||||
@@ -93,50 +86,47 @@ find_package(OpenSSL REQUIRED)
|
||||
find_package(secp256k1 REQUIRED)
|
||||
find_package(SOCI REQUIRED)
|
||||
find_package(SQLite3 REQUIRED)
|
||||
find_package(wasmi REQUIRED)
|
||||
find_package(xxHash REQUIRED)
|
||||
|
||||
target_link_libraries(
|
||||
xrpl_libs
|
||||
INTERFACE
|
||||
ed25519::ed25519
|
||||
lz4::lz4
|
||||
OpenSSL::Crypto
|
||||
OpenSSL::SSL
|
||||
secp256k1::secp256k1
|
||||
soci::soci
|
||||
SQLite::SQLite3
|
||||
)
|
||||
INTERFACE ed25519::ed25519
|
||||
lz4::lz4
|
||||
OpenSSL::Crypto
|
||||
OpenSSL::SSL
|
||||
secp256k1::secp256k1
|
||||
soci::soci
|
||||
SQLite::SQLite3)
|
||||
|
||||
option(rocksdb "Enable RocksDB" ON)
|
||||
if(rocksdb)
|
||||
if (rocksdb)
|
||||
find_package(RocksDB REQUIRED)
|
||||
set_target_properties(
|
||||
RocksDB::rocksdb
|
||||
PROPERTIES INTERFACE_COMPILE_DEFINITIONS XRPL_ROCKSDB_AVAILABLE=1
|
||||
)
|
||||
set_target_properties(RocksDB::rocksdb PROPERTIES INTERFACE_COMPILE_DEFINITIONS
|
||||
XRPL_ROCKSDB_AVAILABLE=1)
|
||||
target_link_libraries(xrpl_libs INTERFACE RocksDB::rocksdb)
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
# Work around changes to Conan recipe for now.
|
||||
if(TARGET nudb::core)
|
||||
if (TARGET nudb::core)
|
||||
set(nudb nudb::core)
|
||||
elseif(TARGET NuDB::nudb)
|
||||
elseif (TARGET NuDB::nudb)
|
||||
set(nudb NuDB::nudb)
|
||||
else()
|
||||
else ()
|
||||
message(FATAL_ERROR "unknown nudb target")
|
||||
endif()
|
||||
endif ()
|
||||
target_link_libraries(xrpl_libs INTERFACE ${nudb})
|
||||
|
||||
if(coverage)
|
||||
if (coverage)
|
||||
include(XrplCov)
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
set(PROJECT_EXPORT_SET XrplExports)
|
||||
include(XrplCore)
|
||||
include(XrplInstall)
|
||||
include(XrplValidatorKeys)
|
||||
|
||||
if(tests)
|
||||
if (tests)
|
||||
include(CTest)
|
||||
add_subdirectory(src/tests/libxrpl)
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
@@ -1,32 +1,29 @@
|
||||
macro(exclude_from_default target_)
|
||||
macro (exclude_from_default target_)
|
||||
set_target_properties(${target_} PROPERTIES EXCLUDE_FROM_ALL ON)
|
||||
set_target_properties(${target_} PROPERTIES EXCLUDE_FROM_DEFAULT_BUILD ON)
|
||||
endmacro()
|
||||
endmacro ()
|
||||
|
||||
macro(exclude_if_included target_)
|
||||
macro (exclude_if_included target_)
|
||||
get_directory_property(has_parent PARENT_DIRECTORY)
|
||||
if(has_parent)
|
||||
if (has_parent)
|
||||
exclude_from_default(${target_})
|
||||
endif()
|
||||
endmacro()
|
||||
endif ()
|
||||
endmacro ()
|
||||
|
||||
find_package(Git)
|
||||
|
||||
function(git_branch branch_val)
|
||||
if(NOT GIT_FOUND)
|
||||
function (git_branch branch_val)
|
||||
if (NOT GIT_FOUND)
|
||||
return()
|
||||
endif()
|
||||
endif ()
|
||||
set(_branch "")
|
||||
execute_process(
|
||||
COMMAND ${GIT_EXECUTABLE} "rev-parse" "--abbrev-ref" "HEAD"
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
RESULT_VARIABLE _git_exit_code
|
||||
OUTPUT_VARIABLE _temp_branch
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
ERROR_QUIET
|
||||
)
|
||||
if(_git_exit_code EQUAL 0)
|
||||
execute_process(COMMAND ${GIT_EXECUTABLE} "rev-parse" "--abbrev-ref" "HEAD"
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
RESULT_VARIABLE _git_exit_code
|
||||
OUTPUT_VARIABLE _temp_branch
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET)
|
||||
if (_git_exit_code EQUAL 0)
|
||||
set(_branch ${_temp_branch})
|
||||
endif()
|
||||
endif ()
|
||||
set(${branch_val} "${_branch}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
endfunction ()
|
||||
|
||||
@@ -1,62 +1,50 @@
|
||||
find_program(CCACHE_PATH "ccache")
|
||||
if(NOT CCACHE_PATH)
|
||||
if (NOT CCACHE_PATH)
|
||||
return()
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
# For Linux and macOS we can use the ccache binary directly.
|
||||
if(NOT MSVC)
|
||||
if (NOT MSVC)
|
||||
set(CMAKE_C_COMPILER_LAUNCHER "${CCACHE_PATH}")
|
||||
set(CMAKE_CXX_COMPILER_LAUNCHER "${CCACHE_PATH}")
|
||||
message(STATUS "Found ccache: ${CCACHE_PATH}")
|
||||
return()
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
# For Windows more effort is required. The code below is a modified version of
|
||||
# https://github.com/ccache/ccache/wiki/MS-Visual-Studio#usage-with-cmake.
|
||||
if("${CCACHE_PATH}" MATCHES "chocolatey")
|
||||
if ("${CCACHE_PATH}" MATCHES "chocolatey")
|
||||
message(DEBUG "Ccache path: ${CCACHE_PATH}")
|
||||
# Chocolatey uses a shim executable that we cannot use directly, in which case we have to find the executable it
|
||||
# points to. If we cannot find the target executable then we cannot use ccache.
|
||||
find_program(BASH_PATH "bash")
|
||||
if(NOT BASH_PATH)
|
||||
if (NOT BASH_PATH)
|
||||
message(WARNING "Could not find bash.")
|
||||
return()
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
execute_process(
|
||||
COMMAND
|
||||
bash -c
|
||||
"export LC_ALL='en_US.UTF-8'; ${CCACHE_PATH} --shimgen-noop | grep -oP 'path to executable: \\K.+' | head -c -1"
|
||||
OUTPUT_VARIABLE CCACHE_PATH
|
||||
)
|
||||
execute_process(COMMAND bash -c
|
||||
"export LC_ALL='en_US.UTF-8'; ${CCACHE_PATH} --shimgen-noop | grep -oP 'path to executable: \\K.+' | head -c -1"
|
||||
OUTPUT_VARIABLE CCACHE_PATH)
|
||||
|
||||
if(NOT CCACHE_PATH)
|
||||
if (NOT CCACHE_PATH)
|
||||
message(WARNING "Could not find ccache target.")
|
||||
return()
|
||||
endif()
|
||||
endif ()
|
||||
file(TO_CMAKE_PATH "${CCACHE_PATH}" CCACHE_PATH)
|
||||
endif()
|
||||
endif ()
|
||||
message(STATUS "Found ccache: ${CCACHE_PATH}")
|
||||
|
||||
# Tell cmake to use ccache for compiling with Visual Studio.
|
||||
file(COPY_FILE ${CCACHE_PATH} ${CMAKE_BINARY_DIR}/cl.exe ONLY_IF_DIFFERENT)
|
||||
set(CMAKE_VS_GLOBALS
|
||||
"CLToolExe=cl.exe"
|
||||
"CLToolPath=${CMAKE_BINARY_DIR}"
|
||||
"TrackFileAccess=false"
|
||||
"UseMultiToolTask=true"
|
||||
)
|
||||
set(CMAKE_VS_GLOBALS "CLToolExe=cl.exe" "CLToolPath=${CMAKE_BINARY_DIR}" "TrackFileAccess=false"
|
||||
"UseMultiToolTask=true")
|
||||
|
||||
# By default Visual Studio generators will use /Zi to capture debug information, which is not compatible with ccache, so
|
||||
# tell it to use /Z7 instead.
|
||||
if(MSVC)
|
||||
foreach(
|
||||
var_
|
||||
CMAKE_C_FLAGS_DEBUG
|
||||
CMAKE_C_FLAGS_RELEASE
|
||||
CMAKE_CXX_FLAGS_DEBUG
|
||||
CMAKE_CXX_FLAGS_RELEASE
|
||||
)
|
||||
if (MSVC)
|
||||
foreach (var_ CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE CMAKE_CXX_FLAGS_DEBUG
|
||||
CMAKE_CXX_FLAGS_RELEASE)
|
||||
string(REPLACE "/Zi" "/Z7" ${var_} "${${var_}}")
|
||||
endforeach()
|
||||
endif()
|
||||
endforeach ()
|
||||
endif ()
|
||||
|
||||
@@ -174,45 +174,37 @@ option(CODE_COVERAGE_VERBOSE "Verbose information" FALSE)
|
||||
# Check prereqs
|
||||
find_program(GCOVR_PATH gcovr PATHS ${CMAKE_SOURCE_DIR}/scripts/test)
|
||||
|
||||
if(DEFINED CODE_COVERAGE_GCOV_TOOL)
|
||||
if (DEFINED CODE_COVERAGE_GCOV_TOOL)
|
||||
set(GCOV_TOOL "${CODE_COVERAGE_GCOV_TOOL}")
|
||||
elseif(DEFINED ENV{CODE_COVERAGE_GCOV_TOOL})
|
||||
elseif (DEFINED ENV{CODE_COVERAGE_GCOV_TOOL})
|
||||
set(GCOV_TOOL "$ENV{CODE_COVERAGE_GCOV_TOOL}")
|
||||
elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "(Apple)?[Cc]lang")
|
||||
if(APPLE)
|
||||
execute_process(
|
||||
COMMAND xcrun -f llvm-cov
|
||||
OUTPUT_VARIABLE LLVMCOV_PATH
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
else()
|
||||
elseif ("${CMAKE_CXX_COMPILER_ID}" MATCHES "(Apple)?[Cc]lang")
|
||||
if (APPLE)
|
||||
execute_process(COMMAND xcrun -f llvm-cov OUTPUT_VARIABLE LLVMCOV_PATH
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
else ()
|
||||
find_program(LLVMCOV_PATH llvm-cov)
|
||||
endif()
|
||||
if(LLVMCOV_PATH)
|
||||
endif ()
|
||||
if (LLVMCOV_PATH)
|
||||
set(GCOV_TOOL "${LLVMCOV_PATH} gcov")
|
||||
endif()
|
||||
elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU")
|
||||
endif ()
|
||||
elseif ("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU")
|
||||
find_program(GCOV_PATH gcov)
|
||||
set(GCOV_TOOL "${GCOV_PATH}")
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
# Check supported compiler (Clang, GNU and Flang)
|
||||
get_property(LANGUAGES GLOBAL PROPERTY ENABLED_LANGUAGES)
|
||||
foreach(LANG ${LANGUAGES})
|
||||
if("${CMAKE_${LANG}_COMPILER_ID}" MATCHES "(Apple)?[Cc]lang")
|
||||
if("${CMAKE_${LANG}_COMPILER_VERSION}" VERSION_LESS 3)
|
||||
message(
|
||||
FATAL_ERROR
|
||||
"Clang version must be 3.0.0 or greater! Aborting..."
|
||||
)
|
||||
endif()
|
||||
elseif(
|
||||
NOT "${CMAKE_${LANG}_COMPILER_ID}" MATCHES "GNU"
|
||||
AND NOT "${CMAKE_${LANG}_COMPILER_ID}" MATCHES "(LLVM)?[Ff]lang"
|
||||
)
|
||||
foreach (LANG ${LANGUAGES})
|
||||
if ("${CMAKE_${LANG}_COMPILER_ID}" MATCHES "(Apple)?[Cc]lang")
|
||||
if ("${CMAKE_${LANG}_COMPILER_VERSION}" VERSION_LESS 3)
|
||||
message(FATAL_ERROR "Clang version must be 3.0.0 or greater! Aborting...")
|
||||
endif ()
|
||||
elseif (NOT "${CMAKE_${LANG}_COMPILER_ID}" MATCHES "GNU" AND NOT "${CMAKE_${LANG}_COMPILER_ID}"
|
||||
MATCHES "(LLVM)?[Ff]lang")
|
||||
message(FATAL_ERROR "Compiler is not GNU or Flang! Aborting...")
|
||||
endif()
|
||||
endforeach()
|
||||
endif ()
|
||||
endforeach ()
|
||||
|
||||
set(COVERAGE_COMPILER_FLAGS "-g --coverage" CACHE INTERNAL "")
|
||||
|
||||
@@ -221,7 +213,7 @@ set(COVERAGE_C_COMPILER_FLAGS "")
|
||||
set(COVERAGE_CXX_LINKER_FLAGS "")
|
||||
set(COVERAGE_C_LINKER_FLAGS "")
|
||||
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES "(GNU|Clang)")
|
||||
if (CMAKE_CXX_COMPILER_ID MATCHES "(GNU|Clang)")
|
||||
include(CheckCXXCompilerFlag)
|
||||
include(CheckCCompilerFlag)
|
||||
include(CheckLinkerFlag)
|
||||
@@ -232,77 +224,51 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "(GNU|Clang)")
|
||||
set(COVERAGE_C_LINKER_FLAGS ${COVERAGE_COMPILER_FLAGS})
|
||||
|
||||
check_cxx_compiler_flag(-fprofile-abs-path HAVE_cxx_fprofile_abs_path)
|
||||
if(HAVE_cxx_fprofile_abs_path)
|
||||
set(COVERAGE_CXX_COMPILER_FLAGS
|
||||
"${COVERAGE_CXX_COMPILER_FLAGS} -fprofile-abs-path"
|
||||
)
|
||||
endif()
|
||||
if (HAVE_cxx_fprofile_abs_path)
|
||||
set(COVERAGE_CXX_COMPILER_FLAGS "${COVERAGE_CXX_COMPILER_FLAGS} -fprofile-abs-path")
|
||||
endif ()
|
||||
|
||||
check_c_compiler_flag(-fprofile-abs-path HAVE_c_fprofile_abs_path)
|
||||
if(HAVE_c_fprofile_abs_path)
|
||||
set(COVERAGE_C_COMPILER_FLAGS
|
||||
"${COVERAGE_C_COMPILER_FLAGS} -fprofile-abs-path"
|
||||
)
|
||||
endif()
|
||||
if (HAVE_c_fprofile_abs_path)
|
||||
set(COVERAGE_C_COMPILER_FLAGS "${COVERAGE_C_COMPILER_FLAGS} -fprofile-abs-path")
|
||||
endif ()
|
||||
|
||||
check_linker_flag(CXX -fprofile-abs-path HAVE_cxx_linker_fprofile_abs_path)
|
||||
if(HAVE_cxx_linker_fprofile_abs_path)
|
||||
set(COVERAGE_CXX_LINKER_FLAGS
|
||||
"${COVERAGE_CXX_LINKER_FLAGS} -fprofile-abs-path"
|
||||
)
|
||||
endif()
|
||||
if (HAVE_cxx_linker_fprofile_abs_path)
|
||||
set(COVERAGE_CXX_LINKER_FLAGS "${COVERAGE_CXX_LINKER_FLAGS} -fprofile-abs-path")
|
||||
endif ()
|
||||
|
||||
check_linker_flag(C -fprofile-abs-path HAVE_c_linker_fprofile_abs_path)
|
||||
if(HAVE_c_linker_fprofile_abs_path)
|
||||
set(COVERAGE_C_LINKER_FLAGS
|
||||
"${COVERAGE_C_LINKER_FLAGS} -fprofile-abs-path"
|
||||
)
|
||||
endif()
|
||||
if (HAVE_c_linker_fprofile_abs_path)
|
||||
set(COVERAGE_C_LINKER_FLAGS "${COVERAGE_C_LINKER_FLAGS} -fprofile-abs-path")
|
||||
endif ()
|
||||
|
||||
check_cxx_compiler_flag(-fprofile-update=atomic HAVE_cxx_fprofile_update)
|
||||
if(HAVE_cxx_fprofile_update)
|
||||
set(COVERAGE_CXX_COMPILER_FLAGS
|
||||
"${COVERAGE_CXX_COMPILER_FLAGS} -fprofile-update=atomic"
|
||||
)
|
||||
endif()
|
||||
if (HAVE_cxx_fprofile_update)
|
||||
set(COVERAGE_CXX_COMPILER_FLAGS "${COVERAGE_CXX_COMPILER_FLAGS} -fprofile-update=atomic")
|
||||
endif ()
|
||||
|
||||
check_c_compiler_flag(-fprofile-update=atomic HAVE_c_fprofile_update)
|
||||
if(HAVE_c_fprofile_update)
|
||||
set(COVERAGE_C_COMPILER_FLAGS
|
||||
"${COVERAGE_C_COMPILER_FLAGS} -fprofile-update=atomic"
|
||||
)
|
||||
endif()
|
||||
if (HAVE_c_fprofile_update)
|
||||
set(COVERAGE_C_COMPILER_FLAGS "${COVERAGE_C_COMPILER_FLAGS} -fprofile-update=atomic")
|
||||
endif ()
|
||||
|
||||
check_linker_flag(
|
||||
CXX
|
||||
-fprofile-update=atomic
|
||||
HAVE_cxx_linker_fprofile_update
|
||||
)
|
||||
if(HAVE_cxx_linker_fprofile_update)
|
||||
set(COVERAGE_CXX_LINKER_FLAGS
|
||||
"${COVERAGE_CXX_LINKER_FLAGS} -fprofile-update=atomic"
|
||||
)
|
||||
endif()
|
||||
check_linker_flag(CXX -fprofile-update=atomic HAVE_cxx_linker_fprofile_update)
|
||||
if (HAVE_cxx_linker_fprofile_update)
|
||||
set(COVERAGE_CXX_LINKER_FLAGS "${COVERAGE_CXX_LINKER_FLAGS} -fprofile-update=atomic")
|
||||
endif ()
|
||||
|
||||
check_linker_flag(C -fprofile-update=atomic HAVE_c_linker_fprofile_update)
|
||||
if(HAVE_c_linker_fprofile_update)
|
||||
set(COVERAGE_C_LINKER_FLAGS
|
||||
"${COVERAGE_C_LINKER_FLAGS} -fprofile-update=atomic"
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
if (HAVE_c_linker_fprofile_update)
|
||||
set(COVERAGE_C_LINKER_FLAGS "${COVERAGE_C_LINKER_FLAGS} -fprofile-update=atomic")
|
||||
endif ()
|
||||
|
||||
get_property(
|
||||
GENERATOR_IS_MULTI_CONFIG
|
||||
GLOBAL
|
||||
PROPERTY GENERATOR_IS_MULTI_CONFIG
|
||||
)
|
||||
if(NOT (CMAKE_BUILD_TYPE STREQUAL "Debug" OR GENERATOR_IS_MULTI_CONFIG))
|
||||
message(
|
||||
WARNING
|
||||
"Code coverage results with an optimised (non-Debug) build may be misleading"
|
||||
)
|
||||
endif() # NOT (CMAKE_BUILD_TYPE STREQUAL "Debug" OR GENERATOR_IS_MULTI_CONFIG)
|
||||
endif ()
|
||||
|
||||
get_property(GENERATOR_IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
|
||||
if (NOT (CMAKE_BUILD_TYPE STREQUAL "Debug" OR GENERATOR_IS_MULTI_CONFIG))
|
||||
message(WARNING "Code coverage results with an optimised (non-Debug) build may be misleading")
|
||||
endif () # NOT (CMAKE_BUILD_TYPE STREQUAL "Debug" OR GENERATOR_IS_MULTI_CONFIG)
|
||||
|
||||
# Defines a target for running and collection code coverage information
|
||||
# Builds dependencies, runs the given executable and outputs reports.
|
||||
@@ -326,167 +292,125 @@ endif() # NOT (CMAKE_BUILD_TYPE STREQUAL "Debug" OR GENERATOR_IS_MULTI_CONFIG)
|
||||
# )
|
||||
# The user can set the variable GCOVR_ADDITIONAL_ARGS to supply additional flags to the
|
||||
# GCVOR command.
|
||||
function(setup_target_for_coverage_gcovr)
|
||||
function (setup_target_for_coverage_gcovr)
|
||||
set(options NONE)
|
||||
set(oneValueArgs BASE_DIRECTORY NAME FORMAT)
|
||||
set(multiValueArgs EXCLUDE EXECUTABLE EXECUTABLE_ARGS DEPENDENCIES)
|
||||
cmake_parse_arguments(
|
||||
Coverage
|
||||
"${options}"
|
||||
"${oneValueArgs}"
|
||||
"${multiValueArgs}"
|
||||
${ARGN}
|
||||
)
|
||||
cmake_parse_arguments(Coverage "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||
|
||||
if(NOT GCOV_TOOL)
|
||||
if (NOT GCOV_TOOL)
|
||||
message(FATAL_ERROR "Could not find gcov or llvm-cov tool! Aborting...")
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
if(NOT GCOVR_PATH)
|
||||
if (NOT GCOVR_PATH)
|
||||
message(FATAL_ERROR "Could not find gcovr tool! Aborting...")
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
# Set base directory (as absolute path), or default to PROJECT_SOURCE_DIR
|
||||
if(DEFINED Coverage_BASE_DIRECTORY)
|
||||
if (DEFINED Coverage_BASE_DIRECTORY)
|
||||
get_filename_component(BASEDIR ${Coverage_BASE_DIRECTORY} ABSOLUTE)
|
||||
else()
|
||||
else ()
|
||||
set(BASEDIR ${PROJECT_SOURCE_DIR})
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
if(NOT DEFINED Coverage_FORMAT)
|
||||
if (NOT DEFINED Coverage_FORMAT)
|
||||
set(Coverage_FORMAT xml)
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
if(NOT DEFINED Coverage_EXECUTABLE AND DEFINED Coverage_EXECUTABLE_ARGS)
|
||||
message(
|
||||
FATAL_ERROR
|
||||
"EXECUTABLE_ARGS must not be set if EXECUTABLE is not set"
|
||||
)
|
||||
endif()
|
||||
if (NOT DEFINED Coverage_EXECUTABLE AND DEFINED Coverage_EXECUTABLE_ARGS)
|
||||
message(FATAL_ERROR "EXECUTABLE_ARGS must not be set if EXECUTABLE is not set")
|
||||
endif ()
|
||||
|
||||
if("--output" IN_LIST GCOVR_ADDITIONAL_ARGS)
|
||||
message(
|
||||
FATAL_ERROR
|
||||
"Unsupported --output option detected in GCOVR_ADDITIONAL_ARGS! Aborting..."
|
||||
if ("--output" IN_LIST GCOVR_ADDITIONAL_ARGS)
|
||||
message(FATAL_ERROR "Unsupported --output option detected in GCOVR_ADDITIONAL_ARGS! Aborting..."
|
||||
)
|
||||
else()
|
||||
if(
|
||||
(Coverage_FORMAT STREQUAL "html-details")
|
||||
OR (Coverage_FORMAT STREQUAL "html-nested")
|
||||
)
|
||||
set(GCOVR_OUTPUT_FILE
|
||||
${PROJECT_BINARY_DIR}/${Coverage_NAME}/index.html
|
||||
)
|
||||
else ()
|
||||
if ((Coverage_FORMAT STREQUAL "html-details") OR (Coverage_FORMAT STREQUAL "html-nested"))
|
||||
set(GCOVR_OUTPUT_FILE ${PROJECT_BINARY_DIR}/${Coverage_NAME}/index.html)
|
||||
set(GCOVR_CREATE_FOLDER ${PROJECT_BINARY_DIR}/${Coverage_NAME})
|
||||
elseif(Coverage_FORMAT STREQUAL "html-single")
|
||||
elseif (Coverage_FORMAT STREQUAL "html-single")
|
||||
set(GCOVR_OUTPUT_FILE ${Coverage_NAME}.html)
|
||||
elseif(
|
||||
(Coverage_FORMAT STREQUAL "json-summary")
|
||||
OR (Coverage_FORMAT STREQUAL "json-details")
|
||||
OR (Coverage_FORMAT STREQUAL "coveralls")
|
||||
)
|
||||
elseif ((Coverage_FORMAT STREQUAL "json-summary") OR (Coverage_FORMAT STREQUAL
|
||||
"json-details")
|
||||
OR (Coverage_FORMAT STREQUAL "coveralls"))
|
||||
set(GCOVR_OUTPUT_FILE ${Coverage_NAME}.json)
|
||||
elseif(Coverage_FORMAT STREQUAL "txt")
|
||||
elseif (Coverage_FORMAT STREQUAL "txt")
|
||||
set(GCOVR_OUTPUT_FILE ${Coverage_NAME}.txt)
|
||||
elseif(Coverage_FORMAT STREQUAL "csv")
|
||||
elseif (Coverage_FORMAT STREQUAL "csv")
|
||||
set(GCOVR_OUTPUT_FILE ${Coverage_NAME}.csv)
|
||||
elseif(Coverage_FORMAT STREQUAL "lcov")
|
||||
elseif (Coverage_FORMAT STREQUAL "lcov")
|
||||
set(GCOVR_OUTPUT_FILE ${Coverage_NAME}.lcov)
|
||||
else()
|
||||
else ()
|
||||
set(GCOVR_OUTPUT_FILE ${Coverage_NAME}.xml)
|
||||
endif()
|
||||
endif()
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
if(
|
||||
(Coverage_FORMAT STREQUAL "cobertura")
|
||||
OR (Coverage_FORMAT STREQUAL "xml")
|
||||
)
|
||||
if ((Coverage_FORMAT STREQUAL "cobertura") OR (Coverage_FORMAT STREQUAL "xml"))
|
||||
list(APPEND GCOVR_ADDITIONAL_ARGS --cobertura "${GCOVR_OUTPUT_FILE}")
|
||||
list(APPEND GCOVR_ADDITIONAL_ARGS --cobertura-pretty)
|
||||
set(Coverage_FORMAT cobertura) # overwrite xml
|
||||
elseif(Coverage_FORMAT STREQUAL "sonarqube")
|
||||
elseif (Coverage_FORMAT STREQUAL "sonarqube")
|
||||
list(APPEND GCOVR_ADDITIONAL_ARGS --sonarqube "${GCOVR_OUTPUT_FILE}")
|
||||
elseif(Coverage_FORMAT STREQUAL "jacoco")
|
||||
elseif (Coverage_FORMAT STREQUAL "jacoco")
|
||||
list(APPEND GCOVR_ADDITIONAL_ARGS --jacoco "${GCOVR_OUTPUT_FILE}")
|
||||
list(APPEND GCOVR_ADDITIONAL_ARGS --jacoco-pretty)
|
||||
elseif(Coverage_FORMAT STREQUAL "clover")
|
||||
elseif (Coverage_FORMAT STREQUAL "clover")
|
||||
list(APPEND GCOVR_ADDITIONAL_ARGS --clover "${GCOVR_OUTPUT_FILE}")
|
||||
list(APPEND GCOVR_ADDITIONAL_ARGS --clover-pretty)
|
||||
elseif(Coverage_FORMAT STREQUAL "lcov")
|
||||
elseif (Coverage_FORMAT STREQUAL "lcov")
|
||||
list(APPEND GCOVR_ADDITIONAL_ARGS --lcov "${GCOVR_OUTPUT_FILE}")
|
||||
elseif(Coverage_FORMAT STREQUAL "json-summary")
|
||||
elseif (Coverage_FORMAT STREQUAL "json-summary")
|
||||
list(APPEND GCOVR_ADDITIONAL_ARGS --json-summary "${GCOVR_OUTPUT_FILE}")
|
||||
list(APPEND GCOVR_ADDITIONAL_ARGS --json-summary-pretty)
|
||||
elseif(Coverage_FORMAT STREQUAL "json-details")
|
||||
elseif (Coverage_FORMAT STREQUAL "json-details")
|
||||
list(APPEND GCOVR_ADDITIONAL_ARGS --json "${GCOVR_OUTPUT_FILE}")
|
||||
list(APPEND GCOVR_ADDITIONAL_ARGS --json-pretty)
|
||||
elseif(Coverage_FORMAT STREQUAL "coveralls")
|
||||
elseif (Coverage_FORMAT STREQUAL "coveralls")
|
||||
list(APPEND GCOVR_ADDITIONAL_ARGS --coveralls "${GCOVR_OUTPUT_FILE}")
|
||||
list(APPEND GCOVR_ADDITIONAL_ARGS --coveralls-pretty)
|
||||
elseif(Coverage_FORMAT STREQUAL "csv")
|
||||
elseif (Coverage_FORMAT STREQUAL "csv")
|
||||
list(APPEND GCOVR_ADDITIONAL_ARGS --csv "${GCOVR_OUTPUT_FILE}")
|
||||
elseif(Coverage_FORMAT STREQUAL "txt")
|
||||
elseif (Coverage_FORMAT STREQUAL "txt")
|
||||
list(APPEND GCOVR_ADDITIONAL_ARGS --txt "${GCOVR_OUTPUT_FILE}")
|
||||
elseif(Coverage_FORMAT STREQUAL "html-single")
|
||||
elseif (Coverage_FORMAT STREQUAL "html-single")
|
||||
list(APPEND GCOVR_ADDITIONAL_ARGS --html "${GCOVR_OUTPUT_FILE}")
|
||||
list(APPEND GCOVR_ADDITIONAL_ARGS --html-self-contained)
|
||||
elseif(Coverage_FORMAT STREQUAL "html-nested")
|
||||
elseif (Coverage_FORMAT STREQUAL "html-nested")
|
||||
list(APPEND GCOVR_ADDITIONAL_ARGS --html-nested "${GCOVR_OUTPUT_FILE}")
|
||||
elseif(Coverage_FORMAT STREQUAL "html-details")
|
||||
elseif (Coverage_FORMAT STREQUAL "html-details")
|
||||
list(APPEND GCOVR_ADDITIONAL_ARGS --html-details "${GCOVR_OUTPUT_FILE}")
|
||||
else()
|
||||
message(
|
||||
FATAL_ERROR
|
||||
"Unsupported output style ${Coverage_FORMAT}! Aborting..."
|
||||
)
|
||||
endif()
|
||||
else ()
|
||||
message(FATAL_ERROR "Unsupported output style ${Coverage_FORMAT}! Aborting...")
|
||||
endif ()
|
||||
|
||||
# Collect excludes (CMake 3.4+: Also compute absolute paths)
|
||||
set(GCOVR_EXCLUDES "")
|
||||
foreach(
|
||||
EXCLUDE
|
||||
${Coverage_EXCLUDE}
|
||||
${COVERAGE_EXCLUDES}
|
||||
${COVERAGE_GCOVR_EXCLUDES}
|
||||
)
|
||||
if(CMAKE_VERSION VERSION_GREATER 3.4)
|
||||
get_filename_component(
|
||||
EXCLUDE
|
||||
${EXCLUDE}
|
||||
ABSOLUTE
|
||||
BASE_DIR ${BASEDIR}
|
||||
)
|
||||
endif()
|
||||
foreach (EXCLUDE ${Coverage_EXCLUDE} ${COVERAGE_EXCLUDES} ${COVERAGE_GCOVR_EXCLUDES})
|
||||
if (CMAKE_VERSION VERSION_GREATER 3.4)
|
||||
get_filename_component(EXCLUDE ${EXCLUDE} ABSOLUTE BASE_DIR ${BASEDIR})
|
||||
endif ()
|
||||
list(APPEND GCOVR_EXCLUDES "${EXCLUDE}")
|
||||
endforeach()
|
||||
endforeach ()
|
||||
list(REMOVE_DUPLICATES GCOVR_EXCLUDES)
|
||||
|
||||
# Combine excludes to several -e arguments
|
||||
set(GCOVR_EXCLUDE_ARGS "")
|
||||
foreach(EXCLUDE ${GCOVR_EXCLUDES})
|
||||
foreach (EXCLUDE ${GCOVR_EXCLUDES})
|
||||
list(APPEND GCOVR_EXCLUDE_ARGS "-e")
|
||||
list(APPEND GCOVR_EXCLUDE_ARGS "${EXCLUDE}")
|
||||
endforeach()
|
||||
endforeach ()
|
||||
|
||||
# Set up commands which will be run to generate coverage data
|
||||
# If EXECUTABLE is not set, the user is expected to run the tests manually
|
||||
# before running the coverage target NAME
|
||||
if(DEFINED Coverage_EXECUTABLE)
|
||||
set(GCOVR_EXEC_TESTS_CMD
|
||||
${Coverage_EXECUTABLE}
|
||||
${Coverage_EXECUTABLE_ARGS}
|
||||
)
|
||||
endif()
|
||||
if (DEFINED Coverage_EXECUTABLE)
|
||||
set(GCOVR_EXEC_TESTS_CMD ${Coverage_EXECUTABLE} ${Coverage_EXECUTABLE_ARGS})
|
||||
endif ()
|
||||
|
||||
# Create folder
|
||||
if(DEFINED GCOVR_CREATE_FOLDER)
|
||||
set(GCOVR_FOLDER_CMD
|
||||
${CMAKE_COMMAND}
|
||||
-E
|
||||
make_directory
|
||||
${GCOVR_CREATE_FOLDER}
|
||||
)
|
||||
endif()
|
||||
if (DEFINED GCOVR_CREATE_FOLDER)
|
||||
set(GCOVR_FOLDER_CMD ${CMAKE_COMMAND} -E make_directory ${GCOVR_CREATE_FOLDER})
|
||||
endif ()
|
||||
|
||||
# Running gcovr
|
||||
set(GCOVR_CMD
|
||||
@@ -498,95 +422,56 @@ function(setup_target_for_coverage_gcovr)
|
||||
${BASEDIR}
|
||||
${GCOVR_ADDITIONAL_ARGS}
|
||||
${GCOVR_EXCLUDE_ARGS}
|
||||
--object-directory=${PROJECT_BINARY_DIR}
|
||||
)
|
||||
--object-directory=${PROJECT_BINARY_DIR})
|
||||
|
||||
if(CODE_COVERAGE_VERBOSE)
|
||||
if (CODE_COVERAGE_VERBOSE)
|
||||
message(STATUS "Executed command report")
|
||||
|
||||
if(NOT "${GCOVR_EXEC_TESTS_CMD}" STREQUAL "")
|
||||
if (NOT "${GCOVR_EXEC_TESTS_CMD}" STREQUAL "")
|
||||
message(STATUS "Command to run tests: ")
|
||||
string(
|
||||
REPLACE ";"
|
||||
" "
|
||||
GCOVR_EXEC_TESTS_CMD_SPACED
|
||||
"${GCOVR_EXEC_TESTS_CMD}"
|
||||
)
|
||||
string(REPLACE ";" " " GCOVR_EXEC_TESTS_CMD_SPACED "${GCOVR_EXEC_TESTS_CMD}")
|
||||
message(STATUS "${GCOVR_EXEC_TESTS_CMD_SPACED}")
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
if(NOT "${GCOVR_FOLDER_CMD}" STREQUAL "")
|
||||
if (NOT "${GCOVR_FOLDER_CMD}" STREQUAL "")
|
||||
message(STATUS "Command to create a folder: ")
|
||||
string(
|
||||
REPLACE ";"
|
||||
" "
|
||||
GCOVR_FOLDER_CMD_SPACED
|
||||
"${GCOVR_FOLDER_CMD}"
|
||||
)
|
||||
string(REPLACE ";" " " GCOVR_FOLDER_CMD_SPACED "${GCOVR_FOLDER_CMD}")
|
||||
message(STATUS "${GCOVR_FOLDER_CMD_SPACED}")
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
message(STATUS "Command to generate gcovr coverage data: ")
|
||||
string(REPLACE ";" " " GCOVR_CMD_SPACED "${GCOVR_CMD}")
|
||||
message(STATUS "${GCOVR_CMD_SPACED}")
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
add_custom_target(
|
||||
${Coverage_NAME}
|
||||
COMMAND ${GCOVR_EXEC_TESTS_CMD}
|
||||
COMMAND ${GCOVR_FOLDER_CMD}
|
||||
COMMAND ${GCOVR_CMD}
|
||||
BYPRODUCTS ${GCOVR_OUTPUT_FILE}
|
||||
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
|
||||
DEPENDS ${Coverage_DEPENDENCIES}
|
||||
VERBATIM # Protect arguments to commands
|
||||
COMMENT "Running gcovr to produce code coverage report."
|
||||
)
|
||||
add_custom_target(${Coverage_NAME}
|
||||
COMMAND ${GCOVR_EXEC_TESTS_CMD}
|
||||
COMMAND ${GCOVR_FOLDER_CMD}
|
||||
COMMAND ${GCOVR_CMD}
|
||||
BYPRODUCTS ${GCOVR_OUTPUT_FILE}
|
||||
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
|
||||
DEPENDS ${Coverage_DEPENDENCIES}
|
||||
VERBATIM # Protect arguments to commands
|
||||
COMMENT "Running gcovr to produce code coverage report.")
|
||||
|
||||
# Show info where to find the report
|
||||
add_custom_command(
|
||||
TARGET ${Coverage_NAME}
|
||||
POST_BUILD
|
||||
COMMAND echo
|
||||
COMMENT
|
||||
"Code coverage report saved in ${GCOVR_OUTPUT_FILE} formatted as ${Coverage_FORMAT}"
|
||||
TARGET ${Coverage_NAME} POST_BUILD COMMAND echo
|
||||
COMMENT "Code coverage report saved in ${GCOVR_OUTPUT_FILE} formatted as ${Coverage_FORMAT}"
|
||||
)
|
||||
endfunction() # setup_target_for_coverage_gcovr
|
||||
endfunction () # setup_target_for_coverage_gcovr
|
||||
|
||||
function(add_code_coverage_to_target name scope)
|
||||
separate_arguments(
|
||||
COVERAGE_CXX_COMPILER_FLAGS
|
||||
NATIVE_COMMAND
|
||||
"${COVERAGE_CXX_COMPILER_FLAGS}"
|
||||
)
|
||||
separate_arguments(
|
||||
COVERAGE_C_COMPILER_FLAGS
|
||||
NATIVE_COMMAND
|
||||
"${COVERAGE_C_COMPILER_FLAGS}"
|
||||
)
|
||||
separate_arguments(
|
||||
COVERAGE_CXX_LINKER_FLAGS
|
||||
NATIVE_COMMAND
|
||||
"${COVERAGE_CXX_LINKER_FLAGS}"
|
||||
)
|
||||
separate_arguments(
|
||||
COVERAGE_C_LINKER_FLAGS
|
||||
NATIVE_COMMAND
|
||||
"${COVERAGE_C_LINKER_FLAGS}"
|
||||
)
|
||||
function (add_code_coverage_to_target name scope)
|
||||
separate_arguments(COVERAGE_CXX_COMPILER_FLAGS NATIVE_COMMAND "${COVERAGE_CXX_COMPILER_FLAGS}")
|
||||
separate_arguments(COVERAGE_C_COMPILER_FLAGS NATIVE_COMMAND "${COVERAGE_C_COMPILER_FLAGS}")
|
||||
separate_arguments(COVERAGE_CXX_LINKER_FLAGS NATIVE_COMMAND "${COVERAGE_CXX_LINKER_FLAGS}")
|
||||
separate_arguments(COVERAGE_C_LINKER_FLAGS NATIVE_COMMAND "${COVERAGE_C_LINKER_FLAGS}")
|
||||
|
||||
# Add compiler options to the target
|
||||
target_compile_options(
|
||||
${name}
|
||||
${scope}
|
||||
$<$<COMPILE_LANGUAGE:CXX>:${COVERAGE_CXX_COMPILER_FLAGS}>
|
||||
$<$<COMPILE_LANGUAGE:C>:${COVERAGE_C_COMPILER_FLAGS}>
|
||||
)
|
||||
${name} ${scope} $<$<COMPILE_LANGUAGE:CXX>:${COVERAGE_CXX_COMPILER_FLAGS}>
|
||||
$<$<COMPILE_LANGUAGE:C>:${COVERAGE_C_COMPILER_FLAGS}>)
|
||||
|
||||
target_link_libraries(
|
||||
${name}
|
||||
${scope}
|
||||
$<$<LINK_LANGUAGE:CXX>:${COVERAGE_CXX_LINKER_FLAGS}>
|
||||
$<$<LINK_LANGUAGE:C>:${COVERAGE_C_LINKER_FLAGS}>
|
||||
)
|
||||
endfunction() # add_code_coverage_to_target
|
||||
target_link_libraries(${name} ${scope} $<$<LINK_LANGUAGE:CXX>:${COVERAGE_CXX_LINKER_FLAGS}>
|
||||
$<$<LINK_LANGUAGE:C>:${COVERAGE_C_LINKER_FLAGS}>)
|
||||
endfunction () # add_code_coverage_to_target
|
||||
|
||||
@@ -14,20 +14,20 @@ set(is_gcc FALSE)
|
||||
set(is_msvc FALSE)
|
||||
set(is_xcode FALSE)
|
||||
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES ".*Clang") # Clang or AppleClang
|
||||
if (CMAKE_CXX_COMPILER_ID MATCHES ".*Clang") # Clang or AppleClang
|
||||
set(is_clang TRUE)
|
||||
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
set(is_gcc TRUE)
|
||||
elseif(MSVC)
|
||||
elseif (MSVC)
|
||||
set(is_msvc TRUE)
|
||||
else()
|
||||
else ()
|
||||
message(FATAL_ERROR "Unsupported C++ compiler: ${CMAKE_CXX_COMPILER_ID}")
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
# Xcode generator detection
|
||||
if(CMAKE_GENERATOR STREQUAL "Xcode")
|
||||
if (CMAKE_GENERATOR STREQUAL "Xcode")
|
||||
set(is_xcode TRUE)
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
# --------------------------------------------------------------------
|
||||
# Operating system detection
|
||||
@@ -36,23 +36,23 @@ set(is_linux FALSE)
|
||||
set(is_windows FALSE)
|
||||
set(is_macos FALSE)
|
||||
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||
if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||
set(is_linux TRUE)
|
||||
elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
||||
elseif (CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
||||
set(is_windows TRUE)
|
||||
elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
||||
elseif (CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
||||
set(is_macos TRUE)
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
# --------------------------------------------------------------------
|
||||
# Architecture
|
||||
# --------------------------------------------------------------------
|
||||
set(is_amd64 FALSE)
|
||||
set(is_arm64 FALSE)
|
||||
if(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|AMD64")
|
||||
if (CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|AMD64")
|
||||
set(is_amd64 TRUE)
|
||||
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64|arm64|ARM64")
|
||||
elseif (CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64|arm64|ARM64")
|
||||
set(is_arm64 TRUE)
|
||||
else()
|
||||
else ()
|
||||
message(FATAL_ERROR "Unknown architecture: ${CMAKE_SYSTEM_PROCESSOR}")
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
@@ -4,25 +4,18 @@ set(GIT_BUILD_BRANCH "")
|
||||
set(GIT_COMMIT_HASH "")
|
||||
|
||||
find_package(Git)
|
||||
if(NOT Git_FOUND)
|
||||
if (NOT Git_FOUND)
|
||||
message(WARNING "Git not found. Git branch and commit hash will be empty.")
|
||||
return()
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
set(GIT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/.git)
|
||||
|
||||
execute_process(
|
||||
COMMAND
|
||||
${GIT_EXECUTABLE} --git-dir=${GIT_DIRECTORY} rev-parse --abbrev-ref HEAD
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
OUTPUT_VARIABLE GIT_BUILD_BRANCH
|
||||
)
|
||||
execute_process(COMMAND ${GIT_EXECUTABLE} --git-dir=${GIT_DIRECTORY} rev-parse --abbrev-ref HEAD
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE GIT_BUILD_BRANCH)
|
||||
|
||||
execute_process(
|
||||
COMMAND ${GIT_EXECUTABLE} --git-dir=${GIT_DIRECTORY} rev-parse HEAD
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
OUTPUT_VARIABLE GIT_COMMIT_HASH
|
||||
)
|
||||
execute_process(COMMAND ${GIT_EXECUTABLE} --git-dir=${GIT_DIRECTORY} rev-parse HEAD
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE GIT_COMMIT_HASH)
|
||||
|
||||
message(STATUS "Git branch: ${GIT_BUILD_BRANCH}")
|
||||
message(STATUS "Git commit hash: ${GIT_COMMIT_HASH}")
|
||||
|
||||
@@ -1,22 +1,13 @@
|
||||
include(isolate_headers)
|
||||
|
||||
function(xrpl_add_test name)
|
||||
function (xrpl_add_test name)
|
||||
set(target ${PROJECT_NAME}.test.${name})
|
||||
|
||||
file(
|
||||
GLOB_RECURSE sources
|
||||
CONFIGURE_DEPENDS
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/${name}/*.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/${name}.cpp"
|
||||
)
|
||||
file(GLOB_RECURSE sources CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/${name}/*.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/${name}.cpp")
|
||||
add_executable(${target} ${ARGN} ${sources})
|
||||
|
||||
isolate_headers(
|
||||
${target}
|
||||
"${CMAKE_SOURCE_DIR}"
|
||||
"${CMAKE_SOURCE_DIR}/tests/${name}"
|
||||
PRIVATE
|
||||
)
|
||||
isolate_headers(${target} "${CMAKE_SOURCE_DIR}" "${CMAKE_SOURCE_DIR}/tests/${name}" PRIVATE)
|
||||
|
||||
add_test(NAME ${target} COMMAND ${target})
|
||||
endfunction()
|
||||
endfunction ()
|
||||
|
||||
@@ -14,42 +14,33 @@ include(XrplSanitizers)
|
||||
# add a single global dependency on this interface lib
|
||||
link_libraries(Xrpl::common)
|
||||
# Respect CMAKE_POSITION_INDEPENDENT_CODE setting (may be set by Conan toolchain)
|
||||
if(NOT DEFINED CMAKE_POSITION_INDEPENDENT_CODE)
|
||||
if (NOT DEFINED CMAKE_POSITION_INDEPENDENT_CODE)
|
||||
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||
endif()
|
||||
set_target_properties(
|
||||
common
|
||||
PROPERTIES
|
||||
INTERFACE_POSITION_INDEPENDENT_CODE ${CMAKE_POSITION_INDEPENDENT_CODE}
|
||||
)
|
||||
endif ()
|
||||
set_target_properties(common PROPERTIES INTERFACE_POSITION_INDEPENDENT_CODE
|
||||
${CMAKE_POSITION_INDEPENDENT_CODE})
|
||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
target_compile_definitions(
|
||||
common
|
||||
INTERFACE
|
||||
$<$<CONFIG:Debug>:DEBUG
|
||||
_DEBUG>
|
||||
#[===[
|
||||
INTERFACE $<$<CONFIG:Debug>:DEBUG
|
||||
_DEBUG>
|
||||
#[===[
|
||||
NOTE: CMAKE release builds already have NDEBUG defined, so no need to add it
|
||||
explicitly except for the special case of (profile ON) and (assert OFF).
|
||||
Presumably this is because we don't want profile builds asserting unless
|
||||
asserts were specifically requested.
|
||||
]===]
|
||||
$<$<AND:$<BOOL:${profile}>,$<NOT:$<BOOL:${assert}>>>:NDEBUG>
|
||||
# TODO: Remove once we have migrated functions from OpenSSL 1.x to 3.x.
|
||||
OPENSSL_SUPPRESS_DEPRECATED
|
||||
)
|
||||
$<$<AND:$<BOOL:${profile}>,$<NOT:$<BOOL:${assert}>>>:NDEBUG>
|
||||
# TODO: Remove once we have migrated functions from OpenSSL 1.x to 3.x.
|
||||
OPENSSL_SUPPRESS_DEPRECATED)
|
||||
|
||||
if(MSVC)
|
||||
if (MSVC)
|
||||
# remove existing exception flag since we set it to -EHa
|
||||
string(REGEX REPLACE "[-/]EH[a-z]+" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
|
||||
foreach(
|
||||
var_
|
||||
CMAKE_C_FLAGS_DEBUG
|
||||
CMAKE_C_FLAGS_RELEASE
|
||||
CMAKE_CXX_FLAGS_DEBUG
|
||||
CMAKE_CXX_FLAGS_RELEASE
|
||||
)
|
||||
foreach (var_ CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE CMAKE_CXX_FLAGS_DEBUG
|
||||
CMAKE_CXX_FLAGS_RELEASE)
|
||||
|
||||
# also remove dynamic runtime
|
||||
string(REGEX REPLACE "[-/]MD[d]*" " " ${var_} "${${var_}}")
|
||||
|
||||
@@ -57,143 +48,120 @@ if(MSVC)
|
||||
string(REPLACE "/ZI" "/Zi" ${var_} "${${var_}}")
|
||||
|
||||
# omit debug info completely under CI (not needed)
|
||||
if(is_ci)
|
||||
if (is_ci)
|
||||
string(REPLACE "/Zi" " " ${var_} "${${var_}}")
|
||||
string(REPLACE "/Z7" " " ${var_} "${${var_}}")
|
||||
endif()
|
||||
endforeach()
|
||||
endif ()
|
||||
endforeach ()
|
||||
|
||||
target_compile_options(
|
||||
common
|
||||
INTERFACE # Increase object file max size
|
||||
-bigobj
|
||||
# Floating point behavior
|
||||
-fp:precise
|
||||
# __cdecl calling convention
|
||||
-Gd
|
||||
# Minimal rebuild: disabled
|
||||
-Gm-
|
||||
# Function level linking: disabled
|
||||
-Gy-
|
||||
# Multiprocessor compilation
|
||||
-MP
|
||||
# pragma omp: disabled
|
||||
-openmp-
|
||||
# No error reporting to Internet
|
||||
-errorReport:none
|
||||
# Suppress login banner
|
||||
-nologo
|
||||
# Disable signed/unsigned comparison warnings
|
||||
-wd4018
|
||||
# Disable float to int possible loss of data warnings
|
||||
-wd4244
|
||||
# Disable size_t to T possible loss of data warnings
|
||||
-wd4267
|
||||
# Disable C4800(int to bool performance)
|
||||
-wd4800
|
||||
# Decorated name length exceeded, name was truncated
|
||||
-wd4503
|
||||
$<$<COMPILE_LANGUAGE:CXX>:
|
||||
-EHa
|
||||
-GR
|
||||
>
|
||||
$<$<CONFIG:Release>:-Ox>
|
||||
$<$<AND:$<COMPILE_LANGUAGE:CXX>,$<CONFIG:Debug>>:
|
||||
-GS
|
||||
-Zc:forScope
|
||||
>
|
||||
# static runtime
|
||||
$<$<CONFIG:Debug>:-MTd>
|
||||
$<$<NOT:$<CONFIG:Debug>>:-MT>
|
||||
$<$<BOOL:${werr}>:-WX>
|
||||
)
|
||||
-bigobj
|
||||
# Floating point behavior
|
||||
-fp:precise
|
||||
# __cdecl calling convention
|
||||
-Gd
|
||||
# Minimal rebuild: disabled
|
||||
-Gm-
|
||||
# Function level linking: disabled
|
||||
-Gy-
|
||||
# Multiprocessor compilation
|
||||
-MP
|
||||
# pragma omp: disabled
|
||||
-openmp-
|
||||
# No error reporting to Internet
|
||||
-errorReport:none
|
||||
# Suppress login banner
|
||||
-nologo
|
||||
# Disable signed/unsigned comparison warnings
|
||||
-wd4018
|
||||
# Disable float to int possible loss of data warnings
|
||||
-wd4244
|
||||
# Disable size_t to T possible loss of data warnings
|
||||
-wd4267
|
||||
# Disable C4800(int to bool performance)
|
||||
-wd4800
|
||||
# Decorated name length exceeded, name was truncated
|
||||
-wd4503
|
||||
$<$<COMPILE_LANGUAGE:CXX>:
|
||||
-EHa
|
||||
-GR
|
||||
>
|
||||
$<$<CONFIG:Release>:-Ox>
|
||||
$<$<AND:$<COMPILE_LANGUAGE:CXX>,$<CONFIG:Debug>>:
|
||||
-GS
|
||||
-Zc:forScope
|
||||
>
|
||||
# static runtime
|
||||
$<$<CONFIG:Debug>:-MTd>
|
||||
$<$<NOT:$<CONFIG:Debug>>:-MT>
|
||||
$<$<BOOL:${werr}>:-WX>)
|
||||
target_compile_definitions(
|
||||
common
|
||||
INTERFACE
|
||||
_WIN32_WINNT=0x6000
|
||||
_SCL_SECURE_NO_WARNINGS
|
||||
_CRT_SECURE_NO_WARNINGS
|
||||
WIN32_CONSOLE
|
||||
WIN32_LEAN_AND_MEAN
|
||||
NOMINMAX
|
||||
# TODO: Resolve these warnings, don't just silence them
|
||||
_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS
|
||||
$<$<AND:$<COMPILE_LANGUAGE:CXX>,$<CONFIG:Debug>>:_CRTDBG_MAP_ALLOC>
|
||||
)
|
||||
INTERFACE _WIN32_WINNT=0x6000
|
||||
_SCL_SECURE_NO_WARNINGS
|
||||
_CRT_SECURE_NO_WARNINGS
|
||||
WIN32_CONSOLE
|
||||
WIN32_LEAN_AND_MEAN
|
||||
NOMINMAX
|
||||
# TODO: Resolve these warnings, don't just silence them
|
||||
_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS
|
||||
$<$<AND:$<COMPILE_LANGUAGE:CXX>,$<CONFIG:Debug>>:_CRTDBG_MAP_ALLOC>)
|
||||
target_link_libraries(common INTERFACE -errorreport:none -machine:X64)
|
||||
else()
|
||||
else ()
|
||||
target_compile_options(
|
||||
common
|
||||
INTERFACE
|
||||
-Wall
|
||||
-Wdeprecated
|
||||
$<$<BOOL:${is_clang}>:-Wno-deprecated-declarations>
|
||||
$<$<BOOL:${wextra}>:-Wextra
|
||||
-Wno-unused-parameter>
|
||||
$<$<BOOL:${werr}>:-Werror>
|
||||
-fstack-protector
|
||||
-Wno-sign-compare
|
||||
-Wno-unused-but-set-variable
|
||||
$<$<NOT:$<CONFIG:Debug>>:-fno-strict-aliasing>
|
||||
# tweak gcc optimization for debug
|
||||
$<$<AND:$<BOOL:${is_gcc}>,$<CONFIG:Debug>>:-O0>
|
||||
# Add debug symbols to release config
|
||||
$<$<CONFIG:Release>:-g>
|
||||
)
|
||||
INTERFACE -Wall
|
||||
-Wdeprecated
|
||||
$<$<BOOL:${is_clang}>:-Wno-deprecated-declarations>
|
||||
$<$<BOOL:${wextra}>:-Wextra
|
||||
-Wno-unused-parameter>
|
||||
$<$<BOOL:${werr}>:-Werror>
|
||||
-fstack-protector
|
||||
-Wno-sign-compare
|
||||
-Wno-unused-but-set-variable
|
||||
$<$<NOT:$<CONFIG:Debug>>:-fno-strict-aliasing>
|
||||
# tweak gcc optimization for debug
|
||||
$<$<AND:$<BOOL:${is_gcc}>,$<CONFIG:Debug>>:-O0>
|
||||
# Add debug symbols to release config
|
||||
$<$<CONFIG:Release>:-g>)
|
||||
target_link_libraries(
|
||||
common
|
||||
INTERFACE
|
||||
-rdynamic
|
||||
$<$<BOOL:${is_linux}>:-Wl,-z,relro,-z,now,--build-id>
|
||||
# link to static libc/c++ iff: * static option set and * NOT APPLE (AppleClang does not support static
|
||||
# libc/c++) and * NOT SANITIZERS (sanitizers typically don't work with static libc/c++)
|
||||
$<$<AND:$<BOOL:${static}>,$<NOT:$<BOOL:${APPLE}>>,$<NOT:$<BOOL:${SANITIZERS_ENABLED}>>>:
|
||||
-static-libstdc++
|
||||
-static-libgcc
|
||||
>
|
||||
)
|
||||
endif()
|
||||
INTERFACE -rdynamic
|
||||
$<$<BOOL:${is_linux}>:-Wl,-z,relro,-z,now,--build-id>
|
||||
# link to static libc/c++ iff: * static option set and * NOT APPLE (AppleClang does not support static
|
||||
# libc/c++) and * NOT SANITIZERS (sanitizers typically don't work with static libc/c++)
|
||||
$<$<AND:$<BOOL:${static}>,$<NOT:$<BOOL:${APPLE}>>,$<NOT:$<BOOL:${SANITIZERS_ENABLED}>>>:
|
||||
-static-libstdc++
|
||||
-static-libgcc
|
||||
>)
|
||||
endif ()
|
||||
|
||||
# Antithesis instrumentation will only be built and deployed using machines running Linux.
|
||||
if(voidstar)
|
||||
if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
message(
|
||||
FATAL_ERROR
|
||||
"Antithesis instrumentation requires Debug build type, aborting..."
|
||||
if (voidstar)
|
||||
if (NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
message(FATAL_ERROR "Antithesis instrumentation requires Debug build type, aborting...")
|
||||
elseif (NOT is_linux)
|
||||
message(FATAL_ERROR "Antithesis instrumentation requires Linux, aborting...")
|
||||
elseif (NOT (is_clang AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 16.0))
|
||||
message(FATAL_ERROR "Antithesis instrumentation requires Clang version 16 or later, aborting..."
|
||||
)
|
||||
elseif(NOT is_linux)
|
||||
message(
|
||||
FATAL_ERROR
|
||||
"Antithesis instrumentation requires Linux, aborting..."
|
||||
)
|
||||
elseif(
|
||||
NOT (is_clang AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 16.0)
|
||||
)
|
||||
message(
|
||||
FATAL_ERROR
|
||||
"Antithesis instrumentation requires Clang version 16 or later, aborting..."
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
if(use_mold)
|
||||
if (use_mold)
|
||||
# use mold linker if available
|
||||
execute_process(
|
||||
COMMAND ${CMAKE_CXX_COMPILER} -fuse-ld=mold -Wl,--version
|
||||
ERROR_QUIET
|
||||
OUTPUT_VARIABLE LD_VERSION
|
||||
)
|
||||
if("${LD_VERSION}" MATCHES "mold")
|
||||
execute_process(COMMAND ${CMAKE_CXX_COMPILER} -fuse-ld=mold -Wl,--version ERROR_QUIET
|
||||
OUTPUT_VARIABLE LD_VERSION)
|
||||
if ("${LD_VERSION}" MATCHES "mold")
|
||||
target_link_libraries(common INTERFACE -fuse-ld=mold)
|
||||
endif()
|
||||
endif ()
|
||||
unset(LD_VERSION)
|
||||
elseif(use_gold AND is_gcc)
|
||||
elseif (use_gold AND is_gcc)
|
||||
# use gold linker if available
|
||||
execute_process(
|
||||
COMMAND ${CMAKE_CXX_COMPILER} -fuse-ld=gold -Wl,--version
|
||||
ERROR_QUIET
|
||||
OUTPUT_VARIABLE LD_VERSION
|
||||
)
|
||||
execute_process(COMMAND ${CMAKE_CXX_COMPILER} -fuse-ld=gold -Wl,--version ERROR_QUIET
|
||||
OUTPUT_VARIABLE LD_VERSION)
|
||||
#[=========================================================[
|
||||
NOTE: THE gold linker inserts -rpath as DT_RUNPATH by
|
||||
default instead of DT_RPATH, so you might have slightly
|
||||
@@ -207,37 +175,32 @@ elseif(use_gold AND is_gcc)
|
||||
disabling would be to figure out all the settings
|
||||
required to make gold play nicely with jemalloc.
|
||||
#]=========================================================]
|
||||
if(("${LD_VERSION}" MATCHES "GNU gold") AND (NOT jemalloc))
|
||||
if (("${LD_VERSION}" MATCHES "GNU gold") AND (NOT jemalloc))
|
||||
target_link_libraries(
|
||||
common
|
||||
INTERFACE
|
||||
-fuse-ld=gold
|
||||
-Wl,--no-as-needed
|
||||
#[=========================================================[
|
||||
INTERFACE -fuse-ld=gold
|
||||
-Wl,--no-as-needed
|
||||
#[=========================================================[
|
||||
see https://bugs.launchpad.net/ubuntu/+source/eglibc/+bug/1253638/comments/5
|
||||
DT_RUNPATH does not work great for transitive
|
||||
dependencies (of which boost has a few) - so just
|
||||
switch to DT_RPATH if doing dynamic linking with gold
|
||||
#]=========================================================]
|
||||
$<$<NOT:$<BOOL:${static}>>:-Wl,--disable-new-dtags>
|
||||
)
|
||||
endif()
|
||||
$<$<NOT:$<BOOL:${static}>>:-Wl,--disable-new-dtags>)
|
||||
endif ()
|
||||
unset(LD_VERSION)
|
||||
elseif(use_lld)
|
||||
elseif (use_lld)
|
||||
# use lld linker if available
|
||||
execute_process(
|
||||
COMMAND ${CMAKE_CXX_COMPILER} -fuse-ld=lld -Wl,--version
|
||||
ERROR_QUIET
|
||||
OUTPUT_VARIABLE LD_VERSION
|
||||
)
|
||||
if("${LD_VERSION}" MATCHES "LLD")
|
||||
execute_process(COMMAND ${CMAKE_CXX_COMPILER} -fuse-ld=lld -Wl,--version ERROR_QUIET
|
||||
OUTPUT_VARIABLE LD_VERSION)
|
||||
if ("${LD_VERSION}" MATCHES "LLD")
|
||||
target_link_libraries(common INTERFACE -fuse-ld=lld)
|
||||
endif()
|
||||
endif ()
|
||||
unset(LD_VERSION)
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
if(assert)
|
||||
foreach(var_ CMAKE_C_FLAGS_RELEASE CMAKE_CXX_FLAGS_RELEASE)
|
||||
if (assert)
|
||||
foreach (var_ CMAKE_C_FLAGS_RELEASE CMAKE_CXX_FLAGS_RELEASE)
|
||||
string(REGEX REPLACE "[-/]DNDEBUG" "" ${var_} "${${var_}}")
|
||||
endforeach()
|
||||
endif()
|
||||
endforeach ()
|
||||
endif ()
|
||||
|
||||
@@ -3,58 +3,50 @@ include(CMakeFindDependencyMacro)
|
||||
#[=========================================================[
|
||||
Boost
|
||||
#]=========================================================]
|
||||
if(static OR APPLE OR MSVC)
|
||||
if (static OR APPLE OR MSVC)
|
||||
set(Boost_USE_STATIC_LIBS ON)
|
||||
endif()
|
||||
endif ()
|
||||
set(Boost_USE_MULTITHREADED ON)
|
||||
if(static OR MSVC)
|
||||
if (static OR MSVC)
|
||||
set(Boost_USE_STATIC_RUNTIME ON)
|
||||
else()
|
||||
else ()
|
||||
set(Boost_USE_STATIC_RUNTIME OFF)
|
||||
endif()
|
||||
find_dependency(
|
||||
Boost
|
||||
COMPONENTS
|
||||
chrono
|
||||
container
|
||||
context
|
||||
coroutine
|
||||
date_time
|
||||
filesystem
|
||||
program_options
|
||||
regex
|
||||
system
|
||||
thread
|
||||
)
|
||||
endif ()
|
||||
find_dependency(Boost
|
||||
COMPONENTS
|
||||
chrono
|
||||
container
|
||||
context
|
||||
coroutine
|
||||
date_time
|
||||
filesystem
|
||||
program_options
|
||||
regex
|
||||
system
|
||||
thread)
|
||||
#[=========================================================[
|
||||
OpenSSL
|
||||
#]=========================================================]
|
||||
if(NOT DEFINED OPENSSL_ROOT_DIR)
|
||||
if(DEFINED ENV{OPENSSL_ROOT})
|
||||
if (NOT DEFINED OPENSSL_ROOT_DIR)
|
||||
if (DEFINED ENV{OPENSSL_ROOT})
|
||||
set(OPENSSL_ROOT_DIR $ENV{OPENSSL_ROOT})
|
||||
elseif(APPLE)
|
||||
elseif (APPLE)
|
||||
find_program(homebrew brew)
|
||||
if(homebrew)
|
||||
execute_process(
|
||||
COMMAND ${homebrew} --prefix openssl
|
||||
OUTPUT_VARIABLE OPENSSL_ROOT_DIR
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
if (homebrew)
|
||||
execute_process(COMMAND ${homebrew} --prefix openssl OUTPUT_VARIABLE OPENSSL_ROOT_DIR
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
endif ()
|
||||
endif ()
|
||||
file(TO_CMAKE_PATH "${OPENSSL_ROOT_DIR}" OPENSSL_ROOT_DIR)
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
if(static OR APPLE OR MSVC)
|
||||
if (static OR APPLE OR MSVC)
|
||||
set(OPENSSL_USE_STATIC_LIBS ON)
|
||||
endif()
|
||||
endif ()
|
||||
set(OPENSSL_MSVC_STATIC_RT ON)
|
||||
find_dependency(OpenSSL REQUIRED)
|
||||
find_dependency(ZLIB)
|
||||
find_dependency(date)
|
||||
if(TARGET ZLIB::ZLIB)
|
||||
set_target_properties(
|
||||
OpenSSL::Crypto
|
||||
PROPERTIES INTERFACE_LINK_LIBRARIES ZLIB::ZLIB
|
||||
)
|
||||
endif()
|
||||
if (TARGET ZLIB::ZLIB)
|
||||
set_target_properties(OpenSSL::Crypto PROPERTIES INTERFACE_LINK_LIBRARIES ZLIB::ZLIB)
|
||||
endif ()
|
||||
|
||||
@@ -10,44 +10,25 @@ include(target_protobuf_sources)
|
||||
# so we just build them as a separate library.
|
||||
add_library(xrpl.libpb)
|
||||
set_target_properties(xrpl.libpb PROPERTIES UNITY_BUILD OFF)
|
||||
target_protobuf_sources(
|
||||
xrpl.libpb
|
||||
xrpl/proto
|
||||
LANGUAGE cpp
|
||||
IMPORT_DIRS include/xrpl/proto
|
||||
PROTOS include/xrpl/proto/xrpl.proto
|
||||
)
|
||||
target_protobuf_sources(xrpl.libpb xrpl/proto LANGUAGE cpp IMPORT_DIRS include/xrpl/proto
|
||||
PROTOS include/xrpl/proto/xrpl.proto)
|
||||
|
||||
file(GLOB_RECURSE protos "include/xrpl/proto/org/*.proto")
|
||||
target_protobuf_sources(xrpl.libpb xrpl/proto LANGUAGE cpp IMPORT_DIRS include/xrpl/proto
|
||||
PROTOS "${protos}")
|
||||
target_protobuf_sources(
|
||||
xrpl.libpb
|
||||
xrpl/proto
|
||||
LANGUAGE cpp
|
||||
IMPORT_DIRS include/xrpl/proto
|
||||
PROTOS "${protos}"
|
||||
)
|
||||
target_protobuf_sources(
|
||||
xrpl.libpb
|
||||
xrpl/proto
|
||||
xrpl.libpb xrpl/proto
|
||||
LANGUAGE grpc
|
||||
IMPORT_DIRS include/xrpl/proto
|
||||
PROTOS "${protos}"
|
||||
PLUGIN protoc-gen-grpc=$<TARGET_FILE:gRPC::grpc_cpp_plugin>
|
||||
GENERATE_EXTENSIONS .grpc.pb.h .grpc.pb.cc
|
||||
)
|
||||
GENERATE_EXTENSIONS .grpc.pb.h .grpc.pb.cc)
|
||||
|
||||
target_compile_options(
|
||||
xrpl.libpb
|
||||
PUBLIC
|
||||
$<$<BOOL:${is_msvc}>:-wd4996>
|
||||
$<$<BOOL:${is_xcode}>:
|
||||
--system-header-prefix="google/protobuf"
|
||||
-Wno-deprecated-dynamic-exception-spec
|
||||
>
|
||||
PRIVATE
|
||||
$<$<BOOL:${is_msvc}>:-wd4065>
|
||||
$<$<NOT:$<BOOL:${is_msvc}>>:-Wno-deprecated-declarations>
|
||||
)
|
||||
PUBLIC $<$<BOOL:${is_msvc}>:-wd4996> $<$<BOOL:${is_xcode}>:
|
||||
--system-header-prefix="google/protobuf" -Wno-deprecated-dynamic-exception-spec >
|
||||
PRIVATE $<$<BOOL:${is_msvc}>:-wd4065> $<$<NOT:$<BOOL:${is_msvc}>>:-Wno-deprecated-declarations>)
|
||||
|
||||
target_link_libraries(xrpl.libpb PUBLIC protobuf::libprotobuf gRPC::grpc++)
|
||||
|
||||
@@ -56,21 +37,20 @@ add_library(xrpl.imports.main INTERFACE)
|
||||
|
||||
target_link_libraries(
|
||||
xrpl.imports.main
|
||||
INTERFACE
|
||||
absl::random_random
|
||||
date::date
|
||||
ed25519::ed25519
|
||||
LibArchive::LibArchive
|
||||
OpenSSL::Crypto
|
||||
Xrpl::boost
|
||||
Xrpl::libs
|
||||
Xrpl::opts
|
||||
Xrpl::syslibs
|
||||
secp256k1::secp256k1
|
||||
xrpl.libpb
|
||||
xxHash::xxhash
|
||||
$<$<BOOL:${voidstar}>:antithesis-sdk-cpp>
|
||||
)
|
||||
INTERFACE absl::random_random
|
||||
date::date
|
||||
ed25519::ed25519
|
||||
LibArchive::LibArchive
|
||||
OpenSSL::Crypto
|
||||
Xrpl::boost
|
||||
Xrpl::libs
|
||||
Xrpl::opts
|
||||
Xrpl::syslibs
|
||||
secp256k1::secp256k1
|
||||
wasmi::wasmi
|
||||
xrpl.libpb
|
||||
xxHash::xxhash
|
||||
$<$<BOOL:${voidstar}>:antithesis-sdk-cpp>)
|
||||
|
||||
include(add_module)
|
||||
include(target_link_modules)
|
||||
@@ -81,12 +61,8 @@ target_link_libraries(xrpl.libxrpl.beast PUBLIC xrpl.imports.main)
|
||||
|
||||
include(GitInfo)
|
||||
add_module(xrpl git)
|
||||
target_compile_definitions(
|
||||
xrpl.libxrpl.git
|
||||
PRIVATE
|
||||
GIT_COMMIT_HASH="${GIT_COMMIT_HASH}"
|
||||
GIT_BUILD_BRANCH="${GIT_BUILD_BRANCH}"
|
||||
)
|
||||
target_compile_definitions(xrpl.libxrpl.git PRIVATE GIT_COMMIT_HASH="${GIT_COMMIT_HASH}"
|
||||
GIT_BUILD_BRANCH="${GIT_BUILD_BRANCH}")
|
||||
target_link_libraries(xrpl.libxrpl.git PUBLIC xrpl.imports.main)
|
||||
|
||||
# Level 02
|
||||
@@ -102,79 +78,37 @@ target_link_libraries(xrpl.libxrpl.crypto PUBLIC xrpl.libxrpl.basics)
|
||||
|
||||
# Level 04
|
||||
add_module(xrpl protocol)
|
||||
target_link_libraries(
|
||||
xrpl.libxrpl.protocol
|
||||
PUBLIC xrpl.libxrpl.crypto xrpl.libxrpl.git xrpl.libxrpl.json
|
||||
)
|
||||
target_link_libraries(xrpl.libxrpl.protocol PUBLIC xrpl.libxrpl.crypto xrpl.libxrpl.git
|
||||
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
|
||||
)
|
||||
add_module(xrpl core)
|
||||
target_link_libraries(xrpl.libxrpl.core PUBLIC xrpl.libxrpl.basics xrpl.libxrpl.json
|
||||
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
|
||||
)
|
||||
|
||||
# Level 07
|
||||
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
|
||||
)
|
||||
target_link_libraries(xrpl.libxrpl.net PUBLIC xrpl.libxrpl.basics xrpl.libxrpl.json
|
||||
xrpl.libxrpl.protocol xrpl.libxrpl.resource)
|
||||
|
||||
add_module(xrpl nodestore)
|
||||
target_link_libraries(
|
||||
xrpl.libxrpl.nodestore
|
||||
PUBLIC xrpl.libxrpl.basics xrpl.libxrpl.json xrpl.libxrpl.protocol
|
||||
)
|
||||
target_link_libraries(xrpl.libxrpl.nodestore PUBLIC xrpl.libxrpl.basics xrpl.libxrpl.json
|
||||
xrpl.libxrpl.protocol)
|
||||
|
||||
add_module(xrpl shamap)
|
||||
target_link_libraries(
|
||||
xrpl.libxrpl.shamap
|
||||
PUBLIC
|
||||
xrpl.libxrpl.basics
|
||||
xrpl.libxrpl.crypto
|
||||
xrpl.libxrpl.protocol
|
||||
xrpl.libxrpl.nodestore
|
||||
)
|
||||
target_link_libraries(xrpl.libxrpl.shamap PUBLIC xrpl.libxrpl.basics xrpl.libxrpl.crypto
|
||||
xrpl.libxrpl.protocol xrpl.libxrpl.nodestore)
|
||||
|
||||
add_module(xrpl rdb)
|
||||
target_link_libraries(
|
||||
xrpl.libxrpl.rdb
|
||||
PUBLIC xrpl.libxrpl.basics xrpl.libxrpl.core
|
||||
)
|
||||
target_link_libraries(xrpl.libxrpl.rdb PUBLIC xrpl.libxrpl.basics xrpl.libxrpl.core)
|
||||
|
||||
add_module(xrpl server)
|
||||
target_link_libraries(
|
||||
xrpl.libxrpl.server
|
||||
PUBLIC
|
||||
xrpl.libxrpl.protocol
|
||||
xrpl.libxrpl.core
|
||||
xrpl.libxrpl.rdb
|
||||
xrpl.libxrpl.resource
|
||||
)
|
||||
target_link_libraries(xrpl.libxrpl.server PUBLIC xrpl.libxrpl.protocol xrpl.libxrpl.core
|
||||
xrpl.libxrpl.rdb xrpl.libxrpl.resource)
|
||||
|
||||
add_module(xrpl conditions)
|
||||
target_link_libraries(xrpl.libxrpl.conditions PUBLIC xrpl.libxrpl.server)
|
||||
@@ -182,16 +116,13 @@ target_link_libraries(xrpl.libxrpl.conditions PUBLIC xrpl.libxrpl.server)
|
||||
add_module(xrpl ledger)
|
||||
target_link_libraries(
|
||||
xrpl.libxrpl.ledger
|
||||
PUBLIC
|
||||
xrpl.libxrpl.basics
|
||||
xrpl.libxrpl.json
|
||||
xrpl.libxrpl.protocol
|
||||
xrpl.libxrpl.protocol_autogen
|
||||
xrpl.libxrpl.rdb
|
||||
xrpl.libxrpl.server
|
||||
xrpl.libxrpl.shamap
|
||||
xrpl.libxrpl.conditions
|
||||
)
|
||||
PUBLIC xrpl.libxrpl.basics
|
||||
xrpl.libxrpl.json
|
||||
xrpl.libxrpl.protocol
|
||||
xrpl.libxrpl.rdb
|
||||
xrpl.libxrpl.server
|
||||
xrpl.libxrpl.shamap
|
||||
xrpl.libxrpl.conditions)
|
||||
|
||||
add_module(xrpl tx)
|
||||
target_link_libraries(xrpl.libxrpl.tx PUBLIC xrpl.libxrpl.ledger)
|
||||
@@ -201,11 +132,7 @@ set_target_properties(xrpl.libxrpl PROPERTIES OUTPUT_NAME xrpl)
|
||||
|
||||
add_library(xrpl::libxrpl ALIAS xrpl.libxrpl)
|
||||
|
||||
file(
|
||||
GLOB_RECURSE sources
|
||||
CONFIGURE_DEPENDS
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/src/libxrpl/*.cpp"
|
||||
)
|
||||
file(GLOB_RECURSE sources CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/src/libxrpl/*.cpp")
|
||||
target_sources(xrpl.libxrpl PRIVATE ${sources})
|
||||
|
||||
target_link_modules(
|
||||
@@ -222,13 +149,11 @@ target_link_modules(
|
||||
net
|
||||
nodestore
|
||||
protocol
|
||||
protocol_autogen
|
||||
rdb
|
||||
resource
|
||||
server
|
||||
shamap
|
||||
tx
|
||||
)
|
||||
tx)
|
||||
|
||||
# All headers in libxrpl are in modules.
|
||||
# Uncomment this stanza if you have not yet moved new headers into a module.
|
||||
@@ -239,51 +164,34 @@ target_link_modules(
|
||||
# $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
||||
# $<INSTALL_INTERFACE:include>)
|
||||
|
||||
if(xrpld)
|
||||
if (xrpld)
|
||||
add_executable(xrpld)
|
||||
if(tests)
|
||||
if (tests)
|
||||
target_compile_definitions(xrpld PUBLIC ENABLE_TESTS)
|
||||
target_compile_definitions(
|
||||
xrpld
|
||||
PRIVATE UNIT_TEST_REFERENCE_FEE=${UNIT_TEST_REFERENCE_FEE}
|
||||
)
|
||||
endif()
|
||||
target_include_directories(
|
||||
xrpld
|
||||
PRIVATE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>
|
||||
)
|
||||
target_compile_definitions(xrpld PRIVATE UNIT_TEST_REFERENCE_FEE=${UNIT_TEST_REFERENCE_FEE})
|
||||
endif ()
|
||||
target_include_directories(xrpld PRIVATE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>)
|
||||
|
||||
file(
|
||||
GLOB_RECURSE sources
|
||||
CONFIGURE_DEPENDS
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/src/xrpld/*.cpp"
|
||||
)
|
||||
file(GLOB_RECURSE sources CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/src/xrpld/*.cpp")
|
||||
target_sources(xrpld PRIVATE ${sources})
|
||||
|
||||
if(tests)
|
||||
file(
|
||||
GLOB_RECURSE sources
|
||||
CONFIGURE_DEPENDS
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/src/test/*.cpp"
|
||||
)
|
||||
if (tests)
|
||||
file(GLOB_RECURSE sources CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/src/test/*.cpp")
|
||||
target_sources(xrpld PRIVATE ${sources})
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
target_link_libraries(xrpld Xrpl::boost Xrpl::opts Xrpl::libs xrpl.libxrpl)
|
||||
exclude_if_included(xrpld)
|
||||
# define a macro for tests that might need to
|
||||
# be excluded or run differently in CI environment
|
||||
if(is_ci)
|
||||
if (is_ci)
|
||||
target_compile_definitions(xrpld PRIVATE XRPL_RUNNING_IN_CI)
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
if(voidstar)
|
||||
if (voidstar)
|
||||
target_compile_options(xrpld PRIVATE -fsanitize-coverage=trace-pc-guard)
|
||||
# xrpld requires access to antithesis-sdk-cpp implementation file
|
||||
# antithesis_instrumentation.h, which is not exported as INTERFACE
|
||||
target_include_directories(
|
||||
xrpld
|
||||
PRIVATE ${CMAKE_SOURCE_DIR}/external/antithesis-sdk
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
target_include_directories(xrpld PRIVATE ${CMAKE_SOURCE_DIR}/external/antithesis-sdk)
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
@@ -2,17 +2,14 @@
|
||||
coverage report target
|
||||
#]===================================================================]
|
||||
|
||||
if(NOT coverage)
|
||||
if (NOT coverage)
|
||||
message(FATAL_ERROR "Code coverage not enabled! Aborting ...")
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
|
||||
message(
|
||||
WARNING
|
||||
"Code coverage on Windows is not supported, ignoring 'coverage' flag"
|
||||
)
|
||||
if (CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
|
||||
message(WARNING "Code coverage on Windows is not supported, ignoring 'coverage' flag")
|
||||
return()
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
include(ProcessorCount)
|
||||
ProcessorCount(PROCESSOR_COUNT)
|
||||
@@ -24,30 +21,32 @@ include(CodeCoverage)
|
||||
# `CodeCoverage.cmake`)
|
||||
|
||||
set(GCOVR_ADDITIONAL_ARGS ${coverage_extra_args})
|
||||
if(NOT GCOVR_ADDITIONAL_ARGS STREQUAL "")
|
||||
if (NOT GCOVR_ADDITIONAL_ARGS STREQUAL "")
|
||||
separate_arguments(GCOVR_ADDITIONAL_ARGS)
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
list(
|
||||
APPEND GCOVR_ADDITIONAL_ARGS
|
||||
--exclude-throw-branches
|
||||
--exclude-noncode-lines
|
||||
--exclude-unreachable-branches
|
||||
-s
|
||||
-j
|
||||
${PROCESSOR_COUNT}
|
||||
)
|
||||
list(APPEND
|
||||
GCOVR_ADDITIONAL_ARGS
|
||||
--exclude-throw-branches
|
||||
--exclude-noncode-lines
|
||||
--exclude-unreachable-branches
|
||||
-s
|
||||
-j
|
||||
${PROCESSOR_COUNT})
|
||||
|
||||
setup_target_for_coverage_gcovr(
|
||||
NAME coverage
|
||||
FORMAT ${coverage_format}
|
||||
NAME
|
||||
coverage
|
||||
FORMAT
|
||||
${coverage_format}
|
||||
EXCLUDE
|
||||
"src/test"
|
||||
"src/tests"
|
||||
"include/xrpl/beast/test"
|
||||
"include/xrpl/beast/unit_test"
|
||||
"${CMAKE_BINARY_DIR}/pb-xrpl.libpb"
|
||||
DEPENDENCIES xrpld xrpl.tests
|
||||
)
|
||||
"src/test"
|
||||
"src/tests"
|
||||
"include/xrpl/beast/test"
|
||||
"include/xrpl/beast/unit_test"
|
||||
"${CMAKE_BINARY_DIR}/pb-xrpl.libpb"
|
||||
DEPENDENCIES
|
||||
xrpld
|
||||
xrpl.tests)
|
||||
|
||||
add_code_coverage_to_target(opts INTERFACE)
|
||||
|
||||
@@ -2,90 +2,71 @@
|
||||
docs target (optional)
|
||||
#]===================================================================]
|
||||
|
||||
if(NOT only_docs)
|
||||
if (NOT only_docs)
|
||||
return()
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
find_package(Doxygen)
|
||||
if(NOT TARGET Doxygen::doxygen)
|
||||
if (NOT TARGET Doxygen::doxygen)
|
||||
message(STATUS "doxygen executable not found -- skipping docs target")
|
||||
return()
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
set(doxygen_output_directory "${CMAKE_BINARY_DIR}/docs")
|
||||
set(doxygen_include_path "${CMAKE_CURRENT_SOURCE_DIR}/src")
|
||||
set(doxygen_index_file "${doxygen_output_directory}/html/index.html")
|
||||
set(doxyfile "${CMAKE_CURRENT_SOURCE_DIR}/docs/Doxyfile")
|
||||
|
||||
file(
|
||||
GLOB_RECURSE doxygen_input
|
||||
docs/*.md
|
||||
include/*.h
|
||||
include/*.cpp
|
||||
include/*.md
|
||||
src/*.h
|
||||
src/*.cpp
|
||||
src/*.md
|
||||
Builds/*.md
|
||||
*.md
|
||||
)
|
||||
file(GLOB_RECURSE
|
||||
doxygen_input
|
||||
docs/*.md
|
||||
include/*.h
|
||||
include/*.cpp
|
||||
include/*.md
|
||||
src/*.h
|
||||
src/*.cpp
|
||||
src/*.md
|
||||
Builds/*.md
|
||||
*.md)
|
||||
list(APPEND doxygen_input external/README.md)
|
||||
set(dependencies "${doxygen_input}" "${doxyfile}")
|
||||
|
||||
function(verbose_find_path variable name)
|
||||
function (verbose_find_path variable name)
|
||||
# find_path sets a CACHE variable, so don't try using a "local" variable.
|
||||
find_path(${variable} "${name}" ${ARGN})
|
||||
if(NOT ${variable})
|
||||
if (NOT ${variable})
|
||||
message(NOTICE "could not find ${name}")
|
||||
else()
|
||||
else ()
|
||||
message(STATUS "found ${name}: ${${variable}}/${name}")
|
||||
endif()
|
||||
endfunction()
|
||||
endif ()
|
||||
endfunction ()
|
||||
|
||||
verbose_find_path(
|
||||
doxygen_plantuml_jar_path
|
||||
plantuml.jar
|
||||
PATH_SUFFIXES share/plantuml
|
||||
)
|
||||
verbose_find_path(doxygen_plantuml_jar_path plantuml.jar PATH_SUFFIXES share/plantuml)
|
||||
verbose_find_path(doxygen_dot_path dot)
|
||||
|
||||
# https://en.cppreference.com/w/Cppreference:Archives
|
||||
# https://stackoverflow.com/questions/60822559/how-to-move-a-file-download-from-configure-step-to-build-step
|
||||
set(download_script "${CMAKE_BINARY_DIR}/docs/download-cppreference.cmake")
|
||||
file(
|
||||
WRITE "${download_script}"
|
||||
"file(DOWNLOAD \
|
||||
file(WRITE "${download_script}"
|
||||
"file(DOWNLOAD \
|
||||
https://github.com/PeterFeicht/cppreference-doc/releases/download/v20250209/html-book-20250209.zip \
|
||||
${CMAKE_BINARY_DIR}/docs/cppreference.zip \
|
||||
EXPECTED_HASH MD5=bda585f72fbca4b817b29a3d5746567b \
|
||||
)\n \
|
||||
execute_process( \
|
||||
COMMAND \"${CMAKE_COMMAND}\" -E tar -xf cppreference.zip \
|
||||
)\n"
|
||||
)
|
||||
)\n")
|
||||
set(tagfile "${CMAKE_BINARY_DIR}/docs/cppreference-doxygen-web.tag.xml")
|
||||
add_custom_command(
|
||||
OUTPUT "${tagfile}"
|
||||
COMMAND "${CMAKE_COMMAND}" -P "${download_script}"
|
||||
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/docs"
|
||||
)
|
||||
add_custom_command(OUTPUT "${tagfile}" COMMAND "${CMAKE_COMMAND}" -P "${download_script}"
|
||||
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/docs")
|
||||
set(doxygen_tagfiles "${tagfile}=http://en.cppreference.com/w/")
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT "${doxygen_index_file}"
|
||||
COMMAND
|
||||
"${CMAKE_COMMAND}" -E env
|
||||
"DOXYGEN_OUTPUT_DIRECTORY=${doxygen_output_directory}"
|
||||
"DOXYGEN_INCLUDE_PATH=${doxygen_include_path}"
|
||||
"DOXYGEN_TAGFILES=${doxygen_tagfiles}"
|
||||
"DOXYGEN_PLANTUML_JAR_PATH=${doxygen_plantuml_jar_path}"
|
||||
"DOXYGEN_DOT_PATH=${doxygen_dot_path}" "${DOXYGEN_EXECUTABLE}"
|
||||
"${doxyfile}"
|
||||
COMMAND "${CMAKE_COMMAND}" -E env "DOXYGEN_OUTPUT_DIRECTORY=${doxygen_output_directory}"
|
||||
"DOXYGEN_INCLUDE_PATH=${doxygen_include_path}" "DOXYGEN_TAGFILES=${doxygen_tagfiles}"
|
||||
"DOXYGEN_PLANTUML_JAR_PATH=${doxygen_plantuml_jar_path}"
|
||||
"DOXYGEN_DOT_PATH=${doxygen_dot_path}" "${DOXYGEN_EXECUTABLE}" "${doxyfile}"
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
DEPENDS "${dependencies}" "${tagfile}"
|
||||
)
|
||||
add_custom_target(
|
||||
docs
|
||||
DEPENDS "${doxygen_index_file}"
|
||||
SOURCES "${dependencies}"
|
||||
)
|
||||
DEPENDS "${dependencies}" "${tagfile}")
|
||||
add_custom_target(docs DEPENDS "${doxygen_index_file}" SOURCES "${dependencies}")
|
||||
|
||||
@@ -6,72 +6,57 @@ include(create_symbolic_link)
|
||||
|
||||
# If no suffix is defined for executables (e.g. Windows uses .exe but Linux
|
||||
# and macOS use none), then explicitly set it to the empty string.
|
||||
if(NOT DEFINED suffix)
|
||||
if (NOT DEFINED suffix)
|
||||
set(suffix "")
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
install(
|
||||
TARGETS
|
||||
common
|
||||
opts
|
||||
xrpl_boost
|
||||
xrpl_libs
|
||||
xrpl_syslibs
|
||||
xrpl.imports.main
|
||||
xrpl.libpb
|
||||
xrpl.libxrpl
|
||||
xrpl.libxrpl.basics
|
||||
xrpl.libxrpl.beast
|
||||
xrpl.libxrpl.conditions
|
||||
xrpl.libxrpl.core
|
||||
xrpl.libxrpl.crypto
|
||||
xrpl.libxrpl.git
|
||||
xrpl.libxrpl.json
|
||||
xrpl.libxrpl.rdb
|
||||
xrpl.libxrpl.ledger
|
||||
xrpl.libxrpl.net
|
||||
xrpl.libxrpl.nodestore
|
||||
xrpl.libxrpl.protocol
|
||||
xrpl.libxrpl.protocol_autogen
|
||||
xrpl.libxrpl.resource
|
||||
xrpl.libxrpl.server
|
||||
xrpl.libxrpl.shamap
|
||||
xrpl.libxrpl.tx
|
||||
antithesis-sdk-cpp
|
||||
EXPORT XrplExports
|
||||
LIBRARY DESTINATION lib
|
||||
ARCHIVE DESTINATION lib
|
||||
RUNTIME DESTINATION bin
|
||||
INCLUDES DESTINATION include
|
||||
)
|
||||
install(TARGETS common
|
||||
opts
|
||||
xrpl_boost
|
||||
xrpl_libs
|
||||
xrpl_syslibs
|
||||
xrpl.imports.main
|
||||
xrpl.libpb
|
||||
xrpl.libxrpl
|
||||
xrpl.libxrpl.basics
|
||||
xrpl.libxrpl.beast
|
||||
xrpl.libxrpl.conditions
|
||||
xrpl.libxrpl.core
|
||||
xrpl.libxrpl.crypto
|
||||
xrpl.libxrpl.git
|
||||
xrpl.libxrpl.json
|
||||
xrpl.libxrpl.rdb
|
||||
xrpl.libxrpl.ledger
|
||||
xrpl.libxrpl.net
|
||||
xrpl.libxrpl.nodestore
|
||||
xrpl.libxrpl.protocol
|
||||
xrpl.libxrpl.resource
|
||||
xrpl.libxrpl.server
|
||||
xrpl.libxrpl.shamap
|
||||
xrpl.libxrpl.tx
|
||||
antithesis-sdk-cpp
|
||||
EXPORT XrplExports
|
||||
LIBRARY DESTINATION lib
|
||||
ARCHIVE DESTINATION lib
|
||||
RUNTIME DESTINATION bin
|
||||
INCLUDES
|
||||
DESTINATION include)
|
||||
|
||||
install(
|
||||
DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/include/xrpl"
|
||||
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
|
||||
)
|
||||
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/include/xrpl"
|
||||
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
|
||||
|
||||
install(
|
||||
EXPORT XrplExports
|
||||
FILE XrplTargets.cmake
|
||||
NAMESPACE Xrpl::
|
||||
DESTINATION lib/cmake/xrpl
|
||||
)
|
||||
install(EXPORT XrplExports FILE XrplTargets.cmake NAMESPACE Xrpl:: DESTINATION lib/cmake/xrpl)
|
||||
include(CMakePackageConfigHelpers)
|
||||
write_basic_package_version_file(
|
||||
XrplConfigVersion.cmake
|
||||
VERSION ${xrpld_version}
|
||||
COMPATIBILITY SameMajorVersion
|
||||
)
|
||||
write_basic_package_version_file(XrplConfigVersion.cmake VERSION ${xrpld_version}
|
||||
COMPATIBILITY SameMajorVersion)
|
||||
|
||||
if(is_root_project AND TARGET xrpld)
|
||||
if (is_root_project AND TARGET xrpld)
|
||||
install(TARGETS xrpld RUNTIME DESTINATION bin)
|
||||
set_target_properties(xrpld PROPERTIES INSTALL_RPATH_USE_LINK_PATH ON)
|
||||
# sample configs should not overwrite existing files
|
||||
# install if-not-exists workaround as suggested by
|
||||
# https://cmake.org/Bug/view.php?id=12646
|
||||
install(
|
||||
CODE
|
||||
"
|
||||
install(CODE "
|
||||
macro (copy_if_not_exists SRC DEST NEWNAME)
|
||||
if (NOT EXISTS \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/\${DEST}/\${NEWNAME}\")
|
||||
file (INSTALL FILE_PERMISSIONS OWNER_READ OWNER_WRITE DESTINATION \"\${CMAKE_INSTALL_PREFIX}/\${DEST}\" FILES \"\${SRC}\" RENAME \"\${NEWNAME}\")
|
||||
@@ -81,22 +66,14 @@ if(is_root_project AND TARGET xrpld)
|
||||
endmacro()
|
||||
copy_if_not_exists(\"${CMAKE_CURRENT_SOURCE_DIR}/cfg/xrpld-example.cfg\" etc xrpld.cfg)
|
||||
copy_if_not_exists(\"${CMAKE_CURRENT_SOURCE_DIR}/cfg/validators-example.txt\" etc validators.txt)
|
||||
"
|
||||
)
|
||||
install(
|
||||
CODE
|
||||
"
|
||||
")
|
||||
install(CODE "
|
||||
set(CMAKE_MODULE_PATH \"${CMAKE_MODULE_PATH}\")
|
||||
include(create_symbolic_link)
|
||||
create_symbolic_link(xrpld${suffix} \
|
||||
\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}/rippled${suffix})
|
||||
"
|
||||
)
|
||||
endif()
|
||||
")
|
||||
endif ()
|
||||
|
||||
install(
|
||||
FILES
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/cmake/XrplConfig.cmake
|
||||
${CMAKE_CURRENT_BINARY_DIR}/XrplConfigVersion.cmake
|
||||
DESTINATION lib/cmake/xrpl
|
||||
)
|
||||
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/cmake/XrplConfig.cmake
|
||||
${CMAKE_CURRENT_BINARY_DIR}/XrplConfigVersion.cmake DESTINATION lib/cmake/xrpl)
|
||||
|
||||
@@ -5,55 +5,47 @@
|
||||
include(CompilationEnv)
|
||||
|
||||
# Set defaults for optional variables to avoid uninitialized variable warnings
|
||||
if(NOT DEFINED voidstar)
|
||||
if (NOT DEFINED voidstar)
|
||||
set(voidstar OFF)
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
add_library(opts INTERFACE)
|
||||
add_library(Xrpl::opts ALIAS opts)
|
||||
target_compile_definitions(
|
||||
opts
|
||||
INTERFACE
|
||||
BOOST_ASIO_DISABLE_HANDLER_TYPE_REQUIREMENTS
|
||||
BOOST_ASIO_USE_TS_EXECUTOR_AS_DEFAULT
|
||||
BOOST_CONTAINER_FWD_BAD_DEQUE
|
||||
HAS_UNCAUGHT_EXCEPTIONS=1
|
||||
$<$<BOOL:${boost_show_deprecated}>:
|
||||
BOOST_ASIO_NO_DEPRECATED
|
||||
BOOST_FILESYSTEM_NO_DEPRECATED
|
||||
>
|
||||
$<$<NOT:$<BOOL:${boost_show_deprecated}>>:
|
||||
BOOST_COROUTINES_NO_DEPRECATION_WARNING
|
||||
BOOST_BEAST_ALLOW_DEPRECATED
|
||||
BOOST_FILESYSTEM_DEPRECATED
|
||||
>
|
||||
$<$<BOOL:${beast_no_unit_test_inline}>:BEAST_NO_UNIT_TEST_INLINE=1>
|
||||
$<$<BOOL:${beast_disable_autolink}>:BEAST_DONT_AUTOLINK_TO_WIN32_LIBRARIES=1>
|
||||
$<$<BOOL:${single_io_service_thread}>:XRPL_SINGLE_IO_SERVICE_THREAD=1>
|
||||
$<$<BOOL:${voidstar}>:ENABLE_VOIDSTAR>
|
||||
)
|
||||
INTERFACE BOOST_ASIO_DISABLE_HANDLER_TYPE_REQUIREMENTS
|
||||
BOOST_ASIO_USE_TS_EXECUTOR_AS_DEFAULT
|
||||
BOOST_CONTAINER_FWD_BAD_DEQUE
|
||||
HAS_UNCAUGHT_EXCEPTIONS=1
|
||||
$<$<BOOL:${boost_show_deprecated}>:
|
||||
BOOST_ASIO_NO_DEPRECATED
|
||||
BOOST_FILESYSTEM_NO_DEPRECATED
|
||||
>
|
||||
$<$<NOT:$<BOOL:${boost_show_deprecated}>>:
|
||||
BOOST_COROUTINES_NO_DEPRECATION_WARNING
|
||||
BOOST_BEAST_ALLOW_DEPRECATED
|
||||
BOOST_FILESYSTEM_DEPRECATED
|
||||
>
|
||||
$<$<BOOL:${beast_no_unit_test_inline}>:BEAST_NO_UNIT_TEST_INLINE=1>
|
||||
$<$<BOOL:${beast_disable_autolink}>:BEAST_DONT_AUTOLINK_TO_WIN32_LIBRARIES=1>
|
||||
$<$<BOOL:${single_io_service_thread}>:XRPL_SINGLE_IO_SERVICE_THREAD=1>
|
||||
$<$<BOOL:${voidstar}>:ENABLE_VOIDSTAR>)
|
||||
target_compile_options(
|
||||
opts
|
||||
INTERFACE
|
||||
$<$<AND:$<BOOL:${is_gcc}>,$<COMPILE_LANGUAGE:CXX>>:-Wsuggest-override>
|
||||
$<$<BOOL:${is_gcc}>:-Wno-maybe-uninitialized>
|
||||
$<$<BOOL:${perf}>:-fno-omit-frame-pointer>
|
||||
$<$<BOOL:${profile}>:-pg>
|
||||
$<$<AND:$<BOOL:${is_gcc}>,$<BOOL:${profile}>>:-p>
|
||||
)
|
||||
INTERFACE $<$<AND:$<BOOL:${is_gcc}>,$<COMPILE_LANGUAGE:CXX>>:-Wsuggest-override>
|
||||
$<$<BOOL:${is_gcc}>:-Wno-maybe-uninitialized>
|
||||
$<$<BOOL:${perf}>:-fno-omit-frame-pointer>
|
||||
$<$<BOOL:${profile}>:-pg>
|
||||
$<$<AND:$<BOOL:${is_gcc}>,$<BOOL:${profile}>>:-p>)
|
||||
|
||||
target_link_libraries(
|
||||
opts
|
||||
INTERFACE
|
||||
$<$<BOOL:${profile}>:-pg>
|
||||
$<$<AND:$<BOOL:${is_gcc}>,$<BOOL:${profile}>>:-p>
|
||||
)
|
||||
target_link_libraries(opts INTERFACE $<$<BOOL:${profile}>:-pg>
|
||||
$<$<AND:$<BOOL:${is_gcc}>,$<BOOL:${profile}>>:-p>)
|
||||
|
||||
if(jemalloc)
|
||||
if (jemalloc)
|
||||
find_package(jemalloc REQUIRED)
|
||||
target_compile_definitions(opts INTERFACE PROFILE_JEMALLOC)
|
||||
target_link_libraries(opts INTERFACE jemalloc::jemalloc)
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
#[===================================================================[
|
||||
xrpld transitive library deps via an interface library
|
||||
@@ -63,33 +55,31 @@ add_library(xrpl_syslibs INTERFACE)
|
||||
add_library(Xrpl::syslibs ALIAS xrpl_syslibs)
|
||||
target_link_libraries(
|
||||
xrpl_syslibs
|
||||
INTERFACE
|
||||
$<$<BOOL:${is_msvc}>:
|
||||
legacy_stdio_definitions.lib
|
||||
Shlwapi
|
||||
kernel32
|
||||
user32
|
||||
gdi32
|
||||
winspool
|
||||
comdlg32
|
||||
advapi32
|
||||
shell32
|
||||
ole32
|
||||
oleaut32
|
||||
uuid
|
||||
odbc32
|
||||
odbccp32
|
||||
crypt32
|
||||
>
|
||||
$<$<NOT:$<BOOL:${is_msvc}>>:dl>
|
||||
$<$<NOT:$<OR:$<BOOL:${is_msvc}>,$<BOOL:${is_macos}>>>:rt>
|
||||
)
|
||||
INTERFACE $<$<BOOL:${is_msvc}>:
|
||||
legacy_stdio_definitions.lib
|
||||
Shlwapi
|
||||
kernel32
|
||||
user32
|
||||
gdi32
|
||||
winspool
|
||||
comdlg32
|
||||
advapi32
|
||||
shell32
|
||||
ole32
|
||||
oleaut32
|
||||
uuid
|
||||
odbc32
|
||||
odbccp32
|
||||
crypt32
|
||||
>
|
||||
$<$<NOT:$<BOOL:${is_msvc}>>:dl>
|
||||
$<$<NOT:$<OR:$<BOOL:${is_msvc}>,$<BOOL:${is_macos}>>>:rt>)
|
||||
|
||||
if(NOT is_msvc)
|
||||
if (NOT is_msvc)
|
||||
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
||||
find_package(Threads)
|
||||
target_link_libraries(xrpl_syslibs INTERFACE Threads::Threads)
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
add_library(xrpl_libs INTERFACE)
|
||||
add_library(Xrpl::libs ALIAS xrpl_libs)
|
||||
|
||||
@@ -1,214 +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(AUTOGEN_TEST_DIR
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/src/tests/libxrpl/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")
|
||||
file(MAKE_DIRECTORY "${AUTOGEN_TEST_DIR}/ledger_objects")
|
||||
file(MAKE_DIRECTORY "${AUTOGEN_TEST_DIR}/transactions")
|
||||
|
||||
# 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 and tests 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" --test-dir
|
||||
"${AUTOGEN_TEST_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 and tests 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" --test-dir
|
||||
"${AUTOGEN_TEST_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/TransactionTests.cpp.mako"
|
||||
"${SCRIPTS_DIR}/templates/LedgerEntry.h.mako"
|
||||
"${SCRIPTS_DIR}/templates/LedgerEntryTests.cpp.mako"
|
||||
"${REQUIREMENTS_FILE}"
|
||||
)
|
||||
endfunction()
|
||||
@@ -44,26 +44,23 @@ include(CompilationEnv)
|
||||
|
||||
# Read environment variable
|
||||
set(SANITIZERS "")
|
||||
if(DEFINED ENV{SANITIZERS})
|
||||
if (DEFINED ENV{SANITIZERS})
|
||||
set(SANITIZERS "$ENV{SANITIZERS}")
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
# Set SANITIZERS_ENABLED flag for use in other modules
|
||||
if(SANITIZERS MATCHES "address|thread|undefinedbehavior")
|
||||
if (SANITIZERS MATCHES "address|thread|undefinedbehavior")
|
||||
set(SANITIZERS_ENABLED TRUE)
|
||||
else()
|
||||
else ()
|
||||
set(SANITIZERS_ENABLED FALSE)
|
||||
return()
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
# Sanitizers are not supported on Windows/MSVC
|
||||
if(is_msvc)
|
||||
message(
|
||||
FATAL_ERROR
|
||||
"Sanitizers are not supported on Windows/MSVC. "
|
||||
"Please unset the SANITIZERS environment variable."
|
||||
)
|
||||
endif()
|
||||
if (is_msvc)
|
||||
message(FATAL_ERROR "Sanitizers are not supported on Windows/MSVC. "
|
||||
"Please unset the SANITIZERS environment variable.")
|
||||
endif ()
|
||||
|
||||
message(STATUS "Configuring sanitizers: ${SANITIZERS}")
|
||||
|
||||
@@ -77,30 +74,24 @@ set(san_list "${SANITIZERS}")
|
||||
string(REPLACE "," ";" san_list "${san_list}")
|
||||
separate_arguments(san_list)
|
||||
|
||||
foreach(san IN LISTS san_list)
|
||||
if(san STREQUAL "address")
|
||||
foreach (san IN LISTS san_list)
|
||||
if (san STREQUAL "address")
|
||||
set(enable_asan TRUE)
|
||||
elseif(san STREQUAL "thread")
|
||||
elseif (san STREQUAL "thread")
|
||||
set(enable_tsan TRUE)
|
||||
elseif(san STREQUAL "undefinedbehavior")
|
||||
elseif (san STREQUAL "undefinedbehavior")
|
||||
set(enable_ubsan TRUE)
|
||||
else()
|
||||
message(
|
||||
FATAL_ERROR
|
||||
"Unsupported sanitizer type: ${san}"
|
||||
"Supported: address, thread, undefinedbehavior and their combinations."
|
||||
)
|
||||
endif()
|
||||
endforeach()
|
||||
else ()
|
||||
message(FATAL_ERROR "Unsupported sanitizer type: ${san}"
|
||||
"Supported: address, thread, undefinedbehavior and their combinations.")
|
||||
endif ()
|
||||
endforeach ()
|
||||
|
||||
# Validate sanitizer compatibility
|
||||
if(enable_asan AND enable_tsan)
|
||||
message(
|
||||
FATAL_ERROR
|
||||
"AddressSanitizer and ThreadSanitizer are incompatible and cannot be enabled simultaneously. "
|
||||
"Use 'address' or 'thread', optionally with 'undefinedbehavior'."
|
||||
)
|
||||
endif()
|
||||
if (enable_asan AND enable_tsan)
|
||||
message(FATAL_ERROR "AddressSanitizer and ThreadSanitizer are incompatible and cannot be enabled simultaneously. "
|
||||
"Use 'address' or 'thread', optionally with 'undefinedbehavior'.")
|
||||
endif ()
|
||||
|
||||
# Frame pointer is required for meaningful stack traces. Sanitizers recommend minimum of -O1 for reasonable performance
|
||||
set(SANITIZERS_COMPILE_FLAGS "-fno-omit-frame-pointer" "-O1")
|
||||
@@ -108,79 +99,66 @@ set(SANITIZERS_COMPILE_FLAGS "-fno-omit-frame-pointer" "-O1")
|
||||
# Build the sanitizer flags list
|
||||
set(SANITIZER_TYPES)
|
||||
|
||||
if(enable_asan)
|
||||
if (enable_asan)
|
||||
list(APPEND SANITIZER_TYPES "address")
|
||||
elseif(enable_tsan)
|
||||
elseif (enable_tsan)
|
||||
list(APPEND SANITIZER_TYPES "thread")
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
if(enable_ubsan)
|
||||
if (enable_ubsan)
|
||||
# UB sanitizer flags
|
||||
list(APPEND SANITIZER_TYPES "undefined" "float-divide-by-zero")
|
||||
if(is_clang)
|
||||
if (is_clang)
|
||||
# Clang supports additional UB checks. More info here
|
||||
# https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html
|
||||
list(APPEND SANITIZER_TYPES "unsigned-integer-overflow")
|
||||
endif()
|
||||
endif()
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
# Configure code model for GCC on amd64 Use large code model for ASAN to avoid relocation errors Use medium code model
|
||||
# for TSAN (large is not compatible with TSAN)
|
||||
set(SANITIZERS_RELOCATION_FLAGS)
|
||||
|
||||
# Compiler-specific configuration
|
||||
if(is_gcc)
|
||||
if (is_gcc)
|
||||
# Disable mold, gold and lld linkers for GCC with sanitizers Use default linker (bfd/ld) which is more lenient with
|
||||
# mixed code models This is needed since the size of instrumented binary exceeds the limits set by mold, lld and
|
||||
# gold linkers
|
||||
set(use_mold OFF CACHE BOOL "Use mold linker" FORCE)
|
||||
set(use_gold OFF CACHE BOOL "Use gold linker" FORCE)
|
||||
set(use_lld OFF CACHE BOOL "Use lld linker" FORCE)
|
||||
message(
|
||||
STATUS
|
||||
" Disabled mold, gold, and lld linkers for GCC with sanitizers"
|
||||
)
|
||||
message(STATUS " Disabled mold, gold, and lld linkers for GCC with sanitizers")
|
||||
|
||||
# Suppress false positive warnings in GCC with stringop-overflow
|
||||
list(APPEND SANITIZERS_COMPILE_FLAGS "-Wno-stringop-overflow")
|
||||
|
||||
if(is_amd64 AND enable_asan)
|
||||
if (is_amd64 AND enable_asan)
|
||||
message(STATUS " Using large code model (-mcmodel=large)")
|
||||
list(APPEND SANITIZERS_COMPILE_FLAGS "-mcmodel=large")
|
||||
list(APPEND SANITIZERS_RELOCATION_FLAGS "-mcmodel=large")
|
||||
elseif(enable_tsan)
|
||||
elseif (enable_tsan)
|
||||
# GCC doesn't support atomic_thread_fence with tsan. Suppress warnings.
|
||||
list(APPEND SANITIZERS_COMPILE_FLAGS "-Wno-tsan")
|
||||
message(STATUS " Using medium code model (-mcmodel=medium)")
|
||||
list(APPEND SANITIZERS_COMPILE_FLAGS "-mcmodel=medium")
|
||||
list(APPEND SANITIZERS_RELOCATION_FLAGS "-mcmodel=medium")
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
# Join sanitizer flags with commas for -fsanitize option
|
||||
list(JOIN SANITIZER_TYPES "," SANITIZER_TYPES_STR)
|
||||
|
||||
# Add sanitizer to compile and link flags
|
||||
list(APPEND SANITIZERS_COMPILE_FLAGS "-fsanitize=${SANITIZER_TYPES_STR}")
|
||||
set(SANITIZERS_LINK_FLAGS
|
||||
"${SANITIZERS_RELOCATION_FLAGS}"
|
||||
"-fsanitize=${SANITIZER_TYPES_STR}"
|
||||
)
|
||||
elseif(is_clang)
|
||||
# Add ignorelist for Clang (GCC doesn't support this) Use CMAKE_SOURCE_DIR to get the path to the ignorelist
|
||||
set(IGNORELIST_PATH
|
||||
"${CMAKE_SOURCE_DIR}/sanitizers/suppressions/sanitizer-ignorelist.txt"
|
||||
)
|
||||
if(NOT EXISTS "${IGNORELIST_PATH}")
|
||||
message(
|
||||
FATAL_ERROR
|
||||
"Sanitizer ignorelist not found: ${IGNORELIST_PATH}"
|
||||
)
|
||||
endif()
|
||||
set(SANITIZERS_LINK_FLAGS "${SANITIZERS_RELOCATION_FLAGS}" "-fsanitize=${SANITIZER_TYPES_STR}")
|
||||
|
||||
list(
|
||||
APPEND SANITIZERS_COMPILE_FLAGS
|
||||
"-fsanitize-ignorelist=${IGNORELIST_PATH}"
|
||||
)
|
||||
elseif (is_clang)
|
||||
# Add ignorelist for Clang (GCC doesn't support this) Use CMAKE_SOURCE_DIR to get the path to the ignorelist
|
||||
set(IGNORELIST_PATH "${CMAKE_SOURCE_DIR}/sanitizers/suppressions/sanitizer-ignorelist.txt")
|
||||
if (NOT EXISTS "${IGNORELIST_PATH}")
|
||||
message(FATAL_ERROR "Sanitizer ignorelist not found: ${IGNORELIST_PATH}")
|
||||
endif ()
|
||||
|
||||
list(APPEND SANITIZERS_COMPILE_FLAGS "-fsanitize-ignorelist=${IGNORELIST_PATH}")
|
||||
message(STATUS " Using sanitizer ignorelist: ${IGNORELIST_PATH}")
|
||||
|
||||
# Join sanitizer flags with commas for -fsanitize option
|
||||
@@ -189,35 +167,31 @@ elseif(is_clang)
|
||||
# Add sanitizer to compile and link flags
|
||||
list(APPEND SANITIZERS_COMPILE_FLAGS "-fsanitize=${SANITIZER_TYPES_STR}")
|
||||
set(SANITIZERS_LINK_FLAGS "-fsanitize=${SANITIZER_TYPES_STR}")
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
message(STATUS " Compile flags: ${SANITIZERS_COMPILE_FLAGS}")
|
||||
message(STATUS " Link flags: ${SANITIZERS_LINK_FLAGS}")
|
||||
|
||||
# Apply the sanitizer flags to the 'common' interface library This is the same library used by XrplCompiler.cmake
|
||||
target_compile_options(
|
||||
common
|
||||
INTERFACE
|
||||
$<$<COMPILE_LANGUAGE:CXX>:${SANITIZERS_COMPILE_FLAGS}>
|
||||
$<$<COMPILE_LANGUAGE:C>:${SANITIZERS_COMPILE_FLAGS}>
|
||||
)
|
||||
target_compile_options(common INTERFACE $<$<COMPILE_LANGUAGE:CXX>:${SANITIZERS_COMPILE_FLAGS}>
|
||||
$<$<COMPILE_LANGUAGE:C>:${SANITIZERS_COMPILE_FLAGS}>)
|
||||
|
||||
# Apply linker flags
|
||||
target_link_options(common INTERFACE ${SANITIZERS_LINK_FLAGS})
|
||||
|
||||
# Define SANITIZERS macro for BuildInfo.cpp
|
||||
set(sanitizers_list)
|
||||
if(enable_asan)
|
||||
if (enable_asan)
|
||||
list(APPEND sanitizers_list "ASAN")
|
||||
endif()
|
||||
if(enable_tsan)
|
||||
endif ()
|
||||
if (enable_tsan)
|
||||
list(APPEND sanitizers_list "TSAN")
|
||||
endif()
|
||||
if(enable_ubsan)
|
||||
endif ()
|
||||
if (enable_ubsan)
|
||||
list(APPEND sanitizers_list "UBSAN")
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
if(sanitizers_list)
|
||||
if (sanitizers_list)
|
||||
list(JOIN sanitizers_list "." sanitizers_str)
|
||||
target_compile_definitions(common INTERFACE SANITIZERS=${sanitizers_str})
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
@@ -7,49 +7,40 @@ include(CompilationEnv)
|
||||
get_property(is_multiconfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
|
||||
|
||||
set(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "" FORCE)
|
||||
if(NOT is_multiconfig)
|
||||
if(NOT CMAKE_BUILD_TYPE)
|
||||
if (NOT is_multiconfig)
|
||||
if (NOT CMAKE_BUILD_TYPE)
|
||||
message(STATUS "Build type not specified - defaulting to Release")
|
||||
set(CMAKE_BUILD_TYPE Release CACHE STRING "build type" FORCE)
|
||||
elseif(
|
||||
NOT (CMAKE_BUILD_TYPE STREQUAL Debug OR CMAKE_BUILD_TYPE STREQUAL Release)
|
||||
)
|
||||
elseif (NOT (CMAKE_BUILD_TYPE STREQUAL Debug OR CMAKE_BUILD_TYPE STREQUAL Release))
|
||||
# for simplicity, these are the only two config types we care about. Limiting the build types simplifies dealing
|
||||
# with external project builds especially
|
||||
message(
|
||||
FATAL_ERROR
|
||||
" *** Only Debug or Release build types are currently supported ***"
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
message(FATAL_ERROR " *** Only Debug or Release build types are currently supported ***")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
if(is_clang) # both Clang and AppleClang
|
||||
if(
|
||||
"${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang"
|
||||
AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 16.0
|
||||
)
|
||||
if (is_clang) # both Clang and AppleClang
|
||||
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS
|
||||
16.0)
|
||||
message(FATAL_ERROR "This project requires clang 16 or later")
|
||||
endif()
|
||||
elseif(is_gcc)
|
||||
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 12.0)
|
||||
endif ()
|
||||
elseif (is_gcc)
|
||||
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 12.0)
|
||||
message(FATAL_ERROR "This project requires GCC 12 or later")
|
||||
endif()
|
||||
endif()
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
# check for in-source build and fail
|
||||
if("${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
|
||||
message(
|
||||
FATAL_ERROR
|
||||
"Builds (in-source) are not allowed in "
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}. Please remove CMakeCache.txt and the CMakeFiles "
|
||||
"directory from ${CMAKE_CURRENT_SOURCE_DIR} and try building in a separate directory."
|
||||
if ("${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
|
||||
message(FATAL_ERROR "Builds (in-source) are not allowed in "
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}. Please remove CMakeCache.txt and the CMakeFiles "
|
||||
"directory from ${CMAKE_CURRENT_SOURCE_DIR} and try building in a separate directory."
|
||||
)
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
if(MSVC AND CMAKE_GENERATOR_PLATFORM STREQUAL "Win32")
|
||||
if (MSVC AND CMAKE_GENERATOR_PLATFORM STREQUAL "Win32")
|
||||
message(FATAL_ERROR "Visual Studio 32-bit build is not supported.")
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
if(APPLE AND NOT HOMEBREW)
|
||||
if (APPLE AND NOT HOMEBREW)
|
||||
find_program(HOMEBREW brew)
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
@@ -5,67 +5,59 @@
|
||||
include(CompilationEnv)
|
||||
|
||||
set(is_ci FALSE)
|
||||
if(DEFINED ENV{CI})
|
||||
if("$ENV{CI}" STREQUAL "true")
|
||||
if (DEFINED ENV{CI})
|
||||
if ("$ENV{CI}" STREQUAL "true")
|
||||
set(is_ci TRUE)
|
||||
endif()
|
||||
endif()
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
get_directory_property(has_parent PARENT_DIRECTORY)
|
||||
if(has_parent)
|
||||
if (has_parent)
|
||||
set(is_root_project OFF)
|
||||
else()
|
||||
else ()
|
||||
set(is_root_project ON)
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
option(assert "Enables asserts, even in release builds" OFF)
|
||||
|
||||
option(xrpld "Build xrpld" ON)
|
||||
|
||||
option(tests "Build tests" ON)
|
||||
if(tests)
|
||||
if (tests)
|
||||
# This setting allows making a separate workflow to test fees other than default 10
|
||||
if(NOT UNIT_TEST_REFERENCE_FEE)
|
||||
if (NOT UNIT_TEST_REFERENCE_FEE)
|
||||
set(UNIT_TEST_REFERENCE_FEE "10" CACHE STRING "")
|
||||
endif()
|
||||
endif()
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
option(unity "Creates a build using UNITY support in cmake." OFF)
|
||||
if(unity)
|
||||
if(NOT is_ci)
|
||||
if (unity)
|
||||
if (NOT is_ci)
|
||||
set(CMAKE_UNITY_BUILD_BATCH_SIZE 15 CACHE STRING "")
|
||||
endif()
|
||||
endif ()
|
||||
set(CMAKE_UNITY_BUILD ON CACHE BOOL "Do a unity build")
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
if(is_clang AND is_linux)
|
||||
if (is_clang AND is_linux)
|
||||
option(voidstar "Enable Antithesis instrumentation." OFF)
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
if(is_gcc OR is_clang)
|
||||
if (is_gcc OR is_clang)
|
||||
include(ProcessorCount)
|
||||
ProcessorCount(PROCESSOR_COUNT)
|
||||
|
||||
option(coverage "Generates coverage info." OFF)
|
||||
option(profile "Add profiling flags" OFF)
|
||||
set(coverage_format
|
||||
"html-details"
|
||||
CACHE STRING
|
||||
"Output format of the coverage report."
|
||||
)
|
||||
set(coverage_extra_args
|
||||
""
|
||||
CACHE STRING
|
||||
"Additional arguments to pass to gcovr."
|
||||
)
|
||||
set(coverage_format "html-details" CACHE STRING "Output format of the coverage report.")
|
||||
set(coverage_extra_args "" CACHE STRING "Additional arguments to pass to gcovr.")
|
||||
option(wextra "compile with extra gcc/clang warnings enabled" ON)
|
||||
else()
|
||||
else ()
|
||||
set(profile OFF CACHE BOOL "gcc/clang only" FORCE)
|
||||
set(coverage OFF CACHE BOOL "gcc/clang only" FORCE)
|
||||
set(wextra OFF CACHE BOOL "gcc/clang only" FORCE)
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
if(is_linux AND NOT SANITIZER)
|
||||
if (is_linux AND NOT SANITIZER)
|
||||
option(BUILD_SHARED_LIBS "build shared xrpl libraries" OFF)
|
||||
option(static "link protobuf, openssl, libc++, and boost statically" ON)
|
||||
option(perf "Enables flags that assist with perf recording" OFF)
|
||||
@@ -73,83 +65,53 @@ if(is_linux AND NOT SANITIZER)
|
||||
option(use_mold "enables detection of mold (binutils) linker" ON)
|
||||
# Set a default value for the log flag based on the build type. This provides a sensible default (on for debug, off
|
||||
# for release) while still allowing the user to override it for any build.
|
||||
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
set(TRUNCATED_LOGS_DEFAULT ON)
|
||||
else()
|
||||
else ()
|
||||
set(TRUNCATED_LOGS_DEFAULT OFF)
|
||||
endif()
|
||||
option(
|
||||
TRUNCATED_THREAD_NAME_LOGS
|
||||
"Show warnings about truncated thread names on Linux."
|
||||
${TRUNCATED_LOGS_DEFAULT}
|
||||
)
|
||||
if(TRUNCATED_THREAD_NAME_LOGS)
|
||||
endif ()
|
||||
option(TRUNCATED_THREAD_NAME_LOGS "Show warnings about truncated thread names on Linux."
|
||||
${TRUNCATED_LOGS_DEFAULT})
|
||||
if (TRUNCATED_THREAD_NAME_LOGS)
|
||||
add_compile_definitions(TRUNCATED_THREAD_NAME_LOGS)
|
||||
endif()
|
||||
else()
|
||||
endif ()
|
||||
else ()
|
||||
# we are not ready to allow shared-libs on windows because it would require export declarations. On macos it's more
|
||||
# feasible, but static openssl produces odd linker errors, thus we disable shared lib builds for now.
|
||||
set(BUILD_SHARED_LIBS
|
||||
OFF
|
||||
CACHE BOOL
|
||||
"build shared xrpl libraries - OFF for win/macos"
|
||||
FORCE
|
||||
)
|
||||
set(BUILD_SHARED_LIBS OFF CACHE BOOL "build shared xrpl libraries - OFF for win/macos" FORCE)
|
||||
set(static ON CACHE BOOL "static link, linux only. ON for WIN/macos" FORCE)
|
||||
set(perf OFF CACHE BOOL "perf flags, linux only" FORCE)
|
||||
set(use_gold OFF CACHE BOOL "gold linker, linux only" FORCE)
|
||||
set(use_mold OFF CACHE BOOL "mold linker, linux only" FORCE)
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
if(is_clang)
|
||||
if (is_clang)
|
||||
option(use_lld "enables detection of lld linker" ON)
|
||||
else()
|
||||
else ()
|
||||
set(use_lld OFF CACHE BOOL "try lld linker, clang only" FORCE)
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
option(jemalloc "Enables jemalloc for heap profiling" OFF)
|
||||
option(werr "treat warnings as errors" OFF)
|
||||
option(
|
||||
local_protobuf
|
||||
"Force a local build of protobuf instead of looking for an installed version."
|
||||
OFF
|
||||
)
|
||||
option(
|
||||
local_grpc
|
||||
"Force a local build of gRPC instead of looking for an installed version."
|
||||
OFF
|
||||
)
|
||||
option(local_protobuf
|
||||
"Force a local build of protobuf instead of looking for an installed version." OFF)
|
||||
option(local_grpc "Force a local build of gRPC instead of looking for an installed version." OFF)
|
||||
|
||||
# the remaining options are obscure and rarely used
|
||||
option(
|
||||
beast_no_unit_test_inline
|
||||
"Prevents unit test definitions from being inserted into global table"
|
||||
OFF
|
||||
)
|
||||
option(
|
||||
single_io_service_thread
|
||||
"Restricts the number of threads calling io_context::run to one. \
|
||||
This can be useful when debugging."
|
||||
OFF
|
||||
)
|
||||
option(
|
||||
boost_show_deprecated
|
||||
"Allow boost to fail on deprecated usage. Only useful if you're trying\
|
||||
to find deprecated calls."
|
||||
OFF
|
||||
)
|
||||
option(beast_no_unit_test_inline
|
||||
"Prevents unit test definitions from being inserted into global table" OFF)
|
||||
option(single_io_service_thread "Restricts the number of threads calling io_context::run to one. \
|
||||
This can be useful when debugging." OFF)
|
||||
option(boost_show_deprecated "Allow boost to fail on deprecated usage. Only useful if you're trying\
|
||||
to find deprecated calls." OFF)
|
||||
|
||||
if(WIN32)
|
||||
option(
|
||||
beast_disable_autolink
|
||||
"Disables autolinking of system libraries on WIN32"
|
||||
OFF
|
||||
)
|
||||
else()
|
||||
if (WIN32)
|
||||
option(beast_disable_autolink "Disables autolinking of system libraries on WIN32" OFF)
|
||||
else ()
|
||||
set(beast_disable_autolink OFF CACHE BOOL "WIN32 only" FORCE)
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
if(coverage)
|
||||
if (coverage)
|
||||
message(STATUS "coverage build requested - forcing Debug build")
|
||||
set(CMAKE_BUILD_TYPE Debug CACHE STRING "build type" FORCE)
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
@@ -1,26 +1,20 @@
|
||||
option(
|
||||
validator_keys
|
||||
"Enables building of validator-keys tool as a separate target (imported via FetchContent)"
|
||||
OFF
|
||||
)
|
||||
option(validator_keys
|
||||
"Enables building of validator-keys tool as a separate target (imported via FetchContent)"
|
||||
OFF)
|
||||
|
||||
if(validator_keys)
|
||||
if (validator_keys)
|
||||
git_branch(current_branch)
|
||||
# default to tracking VK master branch unless we are on release
|
||||
if(NOT (current_branch STREQUAL "release"))
|
||||
if (NOT (current_branch STREQUAL "release"))
|
||||
set(current_branch "master")
|
||||
endif()
|
||||
endif ()
|
||||
message(STATUS "Tracking ValidatorKeys branch: ${current_branch}")
|
||||
|
||||
FetchContent_Declare(
|
||||
validator_keys
|
||||
GIT_REPOSITORY https://github.com/ripple/validator-keys-tool.git
|
||||
GIT_TAG "${current_branch}"
|
||||
)
|
||||
validator_keys GIT_REPOSITORY https://github.com/ripple/validator-keys-tool.git
|
||||
GIT_TAG "${current_branch}")
|
||||
FetchContent_MakeAvailable(validator_keys)
|
||||
set_target_properties(
|
||||
validator-keys
|
||||
PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
|
||||
)
|
||||
set_target_properties(validator-keys PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}")
|
||||
install(TARGETS validator-keys RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||
endif()
|
||||
|
||||
endif ()
|
||||
|
||||
@@ -3,13 +3,13 @@
|
||||
#]===================================================================]
|
||||
|
||||
file(STRINGS src/libxrpl/protocol/BuildInfo.cpp BUILD_INFO)
|
||||
foreach(line_ ${BUILD_INFO})
|
||||
if(line_ MATCHES "versionString[ ]*=[ ]*\"(.+)\"")
|
||||
foreach (line_ ${BUILD_INFO})
|
||||
if (line_ MATCHES "versionString[ ]*=[ ]*\"(.+)\"")
|
||||
set(xrpld_version ${CMAKE_MATCH_1})
|
||||
endif()
|
||||
endforeach()
|
||||
if(xrpld_version)
|
||||
endif ()
|
||||
endforeach ()
|
||||
if (xrpld_version)
|
||||
message(STATUS "xrpld version: ${xrpld_version}")
|
||||
else()
|
||||
else ()
|
||||
message(FATAL_ERROR "unable to determine xrpld version")
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
@@ -12,29 +12,15 @@ include(isolate_headers)
|
||||
# add_module(parent a)
|
||||
# add_module(parent b)
|
||||
# target_link_libraries(project.libparent.b PUBLIC project.libparent.a)
|
||||
function(add_module parent name)
|
||||
function (add_module parent name)
|
||||
set(target ${PROJECT_NAME}.lib${parent}.${name})
|
||||
add_library(${target} OBJECT)
|
||||
file(
|
||||
GLOB_RECURSE sources
|
||||
CONFIGURE_DEPENDS
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/src/lib${parent}/${name}/*.cpp"
|
||||
)
|
||||
file(GLOB_RECURSE sources CONFIGURE_DEPENDS
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/src/lib${parent}/${name}/*.cpp")
|
||||
target_sources(${target} PRIVATE ${sources})
|
||||
target_include_directories(
|
||||
${target}
|
||||
PUBLIC "$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
|
||||
)
|
||||
isolate_headers(
|
||||
${target}
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/include"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/include/${parent}/${name}"
|
||||
PUBLIC
|
||||
)
|
||||
isolate_headers(
|
||||
${target}
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/src"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/src/lib${parent}/${name}"
|
||||
PRIVATE
|
||||
)
|
||||
endfunction()
|
||||
target_include_directories(${target} PUBLIC "$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>")
|
||||
isolate_headers(${target} "${CMAKE_CURRENT_SOURCE_DIR}/include"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/include/${parent}/${name}" PUBLIC)
|
||||
isolate_headers(${target} "${CMAKE_CURRENT_SOURCE_DIR}/src"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/src/lib${parent}/${name}" PRIVATE)
|
||||
endfunction ()
|
||||
|
||||
@@ -1,21 +1,19 @@
|
||||
# file(CREATE_SYMLINK) only works on Windows with administrator privileges. https://stackoverflow.com/a/61244115/618906
|
||||
function(create_symbolic_link target link)
|
||||
if(WIN32)
|
||||
if(NOT IS_SYMLINK "${link}")
|
||||
if(NOT IS_ABSOLUTE "${target}")
|
||||
function (create_symbolic_link target link)
|
||||
if (WIN32)
|
||||
if (NOT IS_SYMLINK "${link}")
|
||||
if (NOT IS_ABSOLUTE "${target}")
|
||||
# Relative links work do not work on Windows.
|
||||
set(target "${link}/../${target}")
|
||||
endif()
|
||||
endif ()
|
||||
file(TO_NATIVE_PATH "${target}" target)
|
||||
file(TO_NATIVE_PATH "${link}" link)
|
||||
execute_process(
|
||||
COMMAND cmd.exe /c mklink /J "${link}" "${target}"
|
||||
)
|
||||
endif()
|
||||
else()
|
||||
execute_process(COMMAND cmd.exe /c mklink /J "${link}" "${target}")
|
||||
endif ()
|
||||
else ()
|
||||
file(CREATE_LINK "${target}" "${link}" SYMBOLIC)
|
||||
endif()
|
||||
if(NOT IS_SYMLINK "${link}")
|
||||
endif ()
|
||||
if (NOT IS_SYMLINK "${link}")
|
||||
message(ERROR "failed to create symlink: <${link}>")
|
||||
endif()
|
||||
endfunction()
|
||||
endif ()
|
||||
endfunction ()
|
||||
|
||||
@@ -1,60 +1,45 @@
|
||||
include(CompilationEnv)
|
||||
include(XrplSanitizers)
|
||||
|
||||
find_package(
|
||||
Boost
|
||||
REQUIRED
|
||||
COMPONENTS
|
||||
chrono
|
||||
container
|
||||
coroutine
|
||||
date_time
|
||||
filesystem
|
||||
json
|
||||
program_options
|
||||
regex
|
||||
system
|
||||
thread
|
||||
)
|
||||
find_package(Boost REQUIRED
|
||||
COMPONENTS chrono
|
||||
container
|
||||
coroutine
|
||||
date_time
|
||||
filesystem
|
||||
json
|
||||
program_options
|
||||
regex
|
||||
system
|
||||
thread)
|
||||
|
||||
add_library(xrpl_boost INTERFACE)
|
||||
add_library(Xrpl::boost ALIAS xrpl_boost)
|
||||
|
||||
target_link_libraries(
|
||||
xrpl_boost
|
||||
INTERFACE
|
||||
Boost::headers
|
||||
Boost::chrono
|
||||
Boost::container
|
||||
Boost::coroutine
|
||||
Boost::date_time
|
||||
Boost::filesystem
|
||||
Boost::json
|
||||
Boost::process
|
||||
Boost::program_options
|
||||
Boost::regex
|
||||
Boost::thread
|
||||
)
|
||||
if(Boost_COMPILER)
|
||||
INTERFACE Boost::headers
|
||||
Boost::chrono
|
||||
Boost::container
|
||||
Boost::coroutine
|
||||
Boost::date_time
|
||||
Boost::filesystem
|
||||
Boost::json
|
||||
Boost::process
|
||||
Boost::program_options
|
||||
Boost::regex
|
||||
Boost::thread)
|
||||
if (Boost_COMPILER)
|
||||
target_link_libraries(xrpl_boost INTERFACE Boost::disable_autolinking)
|
||||
endif()
|
||||
if(SANITIZERS_ENABLED AND is_clang)
|
||||
endif ()
|
||||
if (SANITIZERS_ENABLED AND is_clang)
|
||||
# TODO: gcc does not support -fsanitize-blacklist...can we do something else for gcc ?
|
||||
if(NOT Boost_INCLUDE_DIRS AND TARGET Boost::headers)
|
||||
get_target_property(
|
||||
Boost_INCLUDE_DIRS
|
||||
Boost::headers
|
||||
INTERFACE_INCLUDE_DIRECTORIES
|
||||
)
|
||||
endif()
|
||||
if (NOT Boost_INCLUDE_DIRS AND TARGET Boost::headers)
|
||||
get_target_property(Boost_INCLUDE_DIRS Boost::headers INTERFACE_INCLUDE_DIRECTORIES)
|
||||
endif ()
|
||||
message(STATUS "Adding [${Boost_INCLUDE_DIRS}] to sanitizer blacklist")
|
||||
file(
|
||||
WRITE ${CMAKE_CURRENT_BINARY_DIR}/san_bl.txt
|
||||
"src:${Boost_INCLUDE_DIRS}/*"
|
||||
)
|
||||
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/san_bl.txt "src:${Boost_INCLUDE_DIRS}/*")
|
||||
target_compile_options(
|
||||
opts
|
||||
INTERFACE # ignore boost headers for sanitizing
|
||||
-fsanitize-blacklist=${CMAKE_CURRENT_BINARY_DIR}/san_bl.txt
|
||||
)
|
||||
endif()
|
||||
opts INTERFACE # ignore boost headers for sanitizing
|
||||
-fsanitize-blacklist=${CMAKE_CURRENT_BINARY_DIR}/san_bl.txt)
|
||||
endif ()
|
||||
|
||||
@@ -37,7 +37,7 @@ include(create_symbolic_link)
|
||||
# `${CMAKE_CURRENT_BINARY_DIR}/include/${target}`.
|
||||
#
|
||||
# isolate_headers(target A B scope)
|
||||
function(isolate_headers target A B scope)
|
||||
function (isolate_headers target A B scope)
|
||||
file(RELATIVE_PATH C "${A}" "${B}")
|
||||
set(X "${CMAKE_CURRENT_BINARY_DIR}/modules/${target}")
|
||||
set(Y "${X}/${C}")
|
||||
@@ -45,4 +45,4 @@ function(isolate_headers target A B scope)
|
||||
file(MAKE_DIRECTORY "${parent}")
|
||||
create_symbolic_link("${B}" "${Y}")
|
||||
target_include_directories(${target} ${scope} "$<BUILD_INTERFACE:${X}>")
|
||||
endfunction()
|
||||
endfunction ()
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
# target_link_libraries(project.libparent.b PUBLIC project.libparent.a)
|
||||
# add_library(project.libparent)
|
||||
# target_link_modules(parent PUBLIC a b)
|
||||
function(target_link_modules parent scope)
|
||||
function (target_link_modules parent scope)
|
||||
set(library ${PROJECT_NAME}.lib${parent})
|
||||
foreach(name ${ARGN})
|
||||
foreach (name ${ARGN})
|
||||
set(module ${library}.${name})
|
||||
get_target_property(sources ${library} SOURCES)
|
||||
list(LENGTH sources before)
|
||||
@@ -17,11 +17,8 @@ function(target_link_modules parent scope)
|
||||
list(REMOVE_ITEM sources ${dupes})
|
||||
list(LENGTH sources after)
|
||||
math(EXPR actual "${before} - ${after}")
|
||||
message(
|
||||
STATUS
|
||||
"${module} with ${expected} sources took ${actual} sources from ${library}"
|
||||
)
|
||||
message(STATUS "${module} with ${expected} sources took ${actual} sources from ${library}")
|
||||
set_target_properties(${library} PROPERTIES SOURCES "${sources}")
|
||||
target_link_libraries(${library} ${scope} ${module})
|
||||
endforeach()
|
||||
endfunction()
|
||||
endforeach ()
|
||||
endfunction ()
|
||||
|
||||
@@ -35,31 +35,20 @@ find_package(Protobuf REQUIRED)
|
||||
# This prefix should appear at the start of all your consumer includes.
|
||||
# ARGN:
|
||||
# A list of .proto files.
|
||||
function(target_protobuf_sources target prefix)
|
||||
function (target_protobuf_sources target prefix)
|
||||
set(dir "${CMAKE_CURRENT_BINARY_DIR}/pb-${target}")
|
||||
file(MAKE_DIRECTORY "${dir}/${prefix}")
|
||||
|
||||
protobuf_generate(
|
||||
TARGET ${target}
|
||||
PROTOC_OUT_DIR "${dir}/${prefix}"
|
||||
"${ARGN}"
|
||||
)
|
||||
protobuf_generate(TARGET ${target} PROTOC_OUT_DIR "${dir}/${prefix}" "${ARGN}")
|
||||
target_include_directories(
|
||||
${target}
|
||||
SYSTEM
|
||||
${target} SYSTEM
|
||||
PUBLIC # Allows #include <package/path/to/file.proto> used by consumer files.
|
||||
$<BUILD_INTERFACE:${dir}>
|
||||
# Allows #include "path/to/file.proto" used by generated files.
|
||||
$<BUILD_INTERFACE:${dir}/${prefix}>
|
||||
# Allows #include <package/path/to/file.proto> used by consumer files.
|
||||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
|
||||
# Allows #include "path/to/file.proto" used by generated files.
|
||||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/${prefix}>
|
||||
)
|
||||
install(
|
||||
DIRECTORY ${dir}/
|
||||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
||||
FILES_MATCHING
|
||||
PATTERN "*.h"
|
||||
)
|
||||
endfunction()
|
||||
$<BUILD_INTERFACE:${dir}>
|
||||
# Allows #include "path/to/file.proto" used by generated files.
|
||||
$<BUILD_INTERFACE:${dir}/${prefix}>
|
||||
# Allows #include <package/path/to/file.proto> used by consumer files.
|
||||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
|
||||
# Allows #include "path/to/file.proto" used by generated files.
|
||||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/${prefix}>)
|
||||
install(DIRECTORY ${dir}/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} FILES_MATCHING PATTERN "*.h")
|
||||
endfunction ()
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
"requires": [
|
||||
"zlib/1.3.1#b8bc2603263cf7eccbd6e17e66b0ed76%1765850150.075",
|
||||
"xxhash/0.8.3#681d36a0a6111fc56e5e45ea182c19cc%1765850149.987",
|
||||
"wasmi/1.0.6#407c9db14601a8af1c7dd3b388f3e4cd%1768164779.349",
|
||||
"sqlite3/3.49.1#8631739a4c9b93bd3d6b753bac548a63%1765850149.926",
|
||||
"soci/4.0.3#a9f8d773cd33e356b5879a4b0564f287%1765850149.46",
|
||||
"snappy/1.1.10#968fef506ff261592ec30c574d4a7809%1765850147.878",
|
||||
|
||||
@@ -35,6 +35,7 @@ class Xrpl(ConanFile):
|
||||
"openssl/3.5.5",
|
||||
"secp256k1/0.7.1",
|
||||
"soci/4.0.3",
|
||||
"wasmi/1.0.6",
|
||||
"zlib/1.3.1",
|
||||
]
|
||||
|
||||
@@ -215,6 +216,7 @@ class Xrpl(ConanFile):
|
||||
"soci::soci",
|
||||
"secp256k1::secp256k1",
|
||||
"sqlite3::sqlite",
|
||||
"wasmi::wasmi",
|
||||
"xxhash::xxhash",
|
||||
"zlib::zlib",
|
||||
]
|
||||
|
||||
@@ -7,6 +7,8 @@ ignorePaths:
|
||||
- cmake/**
|
||||
- LICENSE.md
|
||||
- .clang-tidy
|
||||
- src/test/app/wasm_fixtures/**/*.wat
|
||||
- src/test/app/wasm_fixtures/*.c
|
||||
language: en
|
||||
allowCompoundWords: true # TODO (#6334)
|
||||
ignoreRandomStrings: true
|
||||
@@ -60,6 +62,7 @@ words:
|
||||
- Britto
|
||||
- Btrfs
|
||||
- canonicality
|
||||
- cdylib
|
||||
- changespq
|
||||
- checkme
|
||||
- choco
|
||||
@@ -293,6 +296,7 @@ words:
|
||||
- venv
|
||||
- vfalco
|
||||
- vinnie
|
||||
- wasmi
|
||||
- wextra
|
||||
- wptr
|
||||
- writeme
|
||||
|
||||
@@ -729,6 +729,10 @@ abs(Number x) noexcept
|
||||
Number
|
||||
power(Number const& f, unsigned n);
|
||||
|
||||
// logarithm with base 10
|
||||
Number
|
||||
log10(Number const& value, int iterations = 50);
|
||||
|
||||
// Returns f^(1/d)
|
||||
// Uses Newton–Raphson iterations until the result stops changing
|
||||
// to find the root of the polynomial g(x) = x^d - f
|
||||
|
||||
@@ -251,6 +251,12 @@ std::uint8_t constexpr vaultMaximumIOUScale = 18;
|
||||
* another vault; counted from 0 */
|
||||
std::uint8_t constexpr maxAssetCheckDepth = 5;
|
||||
|
||||
/** Maximum length of a Data field in Escrow object that can be updated by WASM code. */
|
||||
std::size_t constexpr maxWasmDataLength = 4 * 1024; // 4KB
|
||||
|
||||
/** Maximum length of parameters passed from WASM code to host functions. */
|
||||
std::size_t constexpr maxWasmParamLength = 1024; // 1KB
|
||||
|
||||
/** A ledger index. */
|
||||
using LedgerIndex = std::uint32_t;
|
||||
|
||||
|
||||
@@ -121,6 +121,8 @@ enum TEMcodes : TERUnderlyingType {
|
||||
temARRAY_TOO_LARGE,
|
||||
temBAD_TRANSFER_FEE,
|
||||
temINVALID_INNER_BATCH,
|
||||
|
||||
temBAD_WASM,
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
@@ -578,7 +578,7 @@ LEDGER_ENTRY(ltLOAN, 0x0089, Loan, loan, ({
|
||||
// The unrounded true total value of the loan.
|
||||
//
|
||||
// - TrueTotalPrincipalOutstanding can be computed using the algorithm
|
||||
// in the ripple::detail::loanPrincipalFromPeriodicPayment function.
|
||||
// in the xrpl::detail::loanPrincipalFromPeriodicPayment function.
|
||||
//
|
||||
// - TrueTotalInterestOutstanding = TrueTotalLoanValue -
|
||||
// TrueTotalPrincipalOutstanding
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
/** This transaction type executes a payment. */
|
||||
#if TRANSACTION_INCLUDE
|
||||
# include <xrpl/tx/transactors/payment/Payment.h>
|
||||
# include <xrpl/tx/transactors/Payment.h>
|
||||
#endif
|
||||
TRANSACTION(ttPAYMENT, 0, Payment,
|
||||
Delegation::delegable,
|
||||
@@ -42,7 +42,7 @@ TRANSACTION(ttPAYMENT, 0, Payment,
|
||||
|
||||
/** This transaction type creates an escrow object. */
|
||||
#if TRANSACTION_INCLUDE
|
||||
# include <xrpl/tx/transactors/escrow/Escrow.h>
|
||||
# include <xrpl/tx/transactors/Escrow.h>
|
||||
#endif
|
||||
TRANSACTION(ttESCROW_CREATE, 1, EscrowCreate,
|
||||
Delegation::delegable,
|
||||
@@ -73,7 +73,7 @@ TRANSACTION(ttESCROW_FINISH, 2, EscrowFinish,
|
||||
|
||||
/** This transaction type adjusts various account settings. */
|
||||
#if TRANSACTION_INCLUDE
|
||||
# include <xrpl/tx/transactors/account/SetAccount.h>
|
||||
# include <xrpl/tx/transactors/SetAccount.h>
|
||||
#endif
|
||||
TRANSACTION(ttACCOUNT_SET, 3, AccountSet,
|
||||
Delegation::notDelegable,
|
||||
@@ -94,7 +94,7 @@ TRANSACTION(ttACCOUNT_SET, 3, AccountSet,
|
||||
|
||||
/** This transaction type cancels an existing escrow. */
|
||||
#if TRANSACTION_INCLUDE
|
||||
# include <xrpl/tx/transactors/escrow/Escrow.h>
|
||||
# include <xrpl/tx/transactors/Escrow.h>
|
||||
#endif
|
||||
TRANSACTION(ttESCROW_CANCEL, 4, EscrowCancel,
|
||||
Delegation::delegable,
|
||||
@@ -107,7 +107,7 @@ TRANSACTION(ttESCROW_CANCEL, 4, EscrowCancel,
|
||||
|
||||
/** This transaction type sets or clears an account's "regular key". */
|
||||
#if TRANSACTION_INCLUDE
|
||||
# include <xrpl/tx/transactors/account/SetRegularKey.h>
|
||||
# include <xrpl/tx/transactors/SetRegularKey.h>
|
||||
#endif
|
||||
TRANSACTION(ttREGULAR_KEY_SET, 5, SetRegularKey,
|
||||
Delegation::notDelegable,
|
||||
@@ -121,7 +121,7 @@ TRANSACTION(ttREGULAR_KEY_SET, 5, SetRegularKey,
|
||||
|
||||
/** This transaction type creates an offer to trade one asset for another. */
|
||||
#if TRANSACTION_INCLUDE
|
||||
# include <xrpl/tx/transactors/dex/CreateOffer.h>
|
||||
# include <xrpl/tx/transactors/Offer/CreateOffer.h>
|
||||
#endif
|
||||
TRANSACTION(ttOFFER_CREATE, 7, OfferCreate,
|
||||
Delegation::delegable,
|
||||
@@ -137,7 +137,7 @@ TRANSACTION(ttOFFER_CREATE, 7, OfferCreate,
|
||||
|
||||
/** This transaction type cancels existing offers to trade one asset for another. */
|
||||
#if TRANSACTION_INCLUDE
|
||||
# include <xrpl/tx/transactors/dex/CancelOffer.h>
|
||||
# include <xrpl/tx/transactors/Offer/CancelOffer.h>
|
||||
#endif
|
||||
TRANSACTION(ttOFFER_CANCEL, 8, OfferCancel,
|
||||
Delegation::delegable,
|
||||
@@ -151,7 +151,7 @@ TRANSACTION(ttOFFER_CANCEL, 8, OfferCancel,
|
||||
|
||||
/** This transaction type creates a new set of tickets. */
|
||||
#if TRANSACTION_INCLUDE
|
||||
# include <xrpl/tx/transactors/system/CreateTicket.h>
|
||||
# include <xrpl/tx/transactors/CreateTicket.h>
|
||||
#endif
|
||||
TRANSACTION(ttTICKET_CREATE, 10, TicketCreate,
|
||||
Delegation::delegable,
|
||||
@@ -167,7 +167,7 @@ TRANSACTION(ttTICKET_CREATE, 10, TicketCreate,
|
||||
// The SignerEntries are optional because a SignerList is deleted by
|
||||
// setting the SignerQuorum to zero and omitting SignerEntries.
|
||||
#if TRANSACTION_INCLUDE
|
||||
# include <xrpl/tx/transactors/account/SetSignerList.h>
|
||||
# include <xrpl/tx/transactors/SetSignerList.h>
|
||||
#endif
|
||||
TRANSACTION(ttSIGNER_LIST_SET, 12, SignerListSet,
|
||||
Delegation::notDelegable,
|
||||
@@ -180,7 +180,7 @@ TRANSACTION(ttSIGNER_LIST_SET, 12, SignerListSet,
|
||||
|
||||
/** This transaction type creates a new unidirectional XRP payment channel. */
|
||||
#if TRANSACTION_INCLUDE
|
||||
# include <xrpl/tx/transactors/payment_channel/PayChan.h>
|
||||
# include <xrpl/tx/transactors/PayChan.h>
|
||||
#endif
|
||||
TRANSACTION(ttPAYCHAN_CREATE, 13, PaymentChannelCreate,
|
||||
Delegation::delegable,
|
||||
@@ -222,7 +222,7 @@ TRANSACTION(ttPAYCHAN_CLAIM, 15, PaymentChannelClaim,
|
||||
|
||||
/** This transaction type creates a new check. */
|
||||
#if TRANSACTION_INCLUDE
|
||||
# include <xrpl/tx/transactors/check/CreateCheck.h>
|
||||
# include <xrpl/tx/transactors/Check/CreateCheck.h>
|
||||
#endif
|
||||
TRANSACTION(ttCHECK_CREATE, 16, CheckCreate,
|
||||
Delegation::delegable,
|
||||
@@ -238,7 +238,7 @@ TRANSACTION(ttCHECK_CREATE, 16, CheckCreate,
|
||||
|
||||
/** This transaction type cashes an existing check. */
|
||||
#if TRANSACTION_INCLUDE
|
||||
# include <xrpl/tx/transactors/check/CashCheck.h>
|
||||
# include <xrpl/tx/transactors/Check/CashCheck.h>
|
||||
#endif
|
||||
TRANSACTION(ttCHECK_CASH, 17, CheckCash,
|
||||
Delegation::delegable,
|
||||
@@ -252,7 +252,7 @@ TRANSACTION(ttCHECK_CASH, 17, CheckCash,
|
||||
|
||||
/** This transaction type cancels an existing check. */
|
||||
#if TRANSACTION_INCLUDE
|
||||
# include <xrpl/tx/transactors/check/CancelCheck.h>
|
||||
# include <xrpl/tx/transactors/Check/CancelCheck.h>
|
||||
#endif
|
||||
TRANSACTION(ttCHECK_CANCEL, 18, CheckCancel,
|
||||
Delegation::delegable,
|
||||
@@ -264,7 +264,7 @@ TRANSACTION(ttCHECK_CANCEL, 18, CheckCancel,
|
||||
|
||||
/** This transaction type grants or revokes authorization to transfer funds. */
|
||||
#if TRANSACTION_INCLUDE
|
||||
# include <xrpl/tx/transactors/payment/DepositPreauth.h>
|
||||
# include <xrpl/tx/transactors/DepositPreauth.h>
|
||||
#endif
|
||||
TRANSACTION(ttDEPOSIT_PREAUTH, 19, DepositPreauth,
|
||||
Delegation::delegable,
|
||||
@@ -279,7 +279,7 @@ TRANSACTION(ttDEPOSIT_PREAUTH, 19, DepositPreauth,
|
||||
|
||||
/** This transaction type modifies a trustline between two accounts. */
|
||||
#if TRANSACTION_INCLUDE
|
||||
# include <xrpl/tx/transactors/token/SetTrust.h>
|
||||
# include <xrpl/tx/transactors/SetTrust.h>
|
||||
#endif
|
||||
TRANSACTION(ttTRUST_SET, 20, TrustSet,
|
||||
Delegation::delegable,
|
||||
@@ -293,7 +293,7 @@ TRANSACTION(ttTRUST_SET, 20, TrustSet,
|
||||
|
||||
/** This transaction type deletes an existing account. */
|
||||
#if TRANSACTION_INCLUDE
|
||||
# include <xrpl/tx/transactors/account/DeleteAccount.h>
|
||||
# include <xrpl/tx/transactors/DeleteAccount.h>
|
||||
#endif
|
||||
TRANSACTION(ttACCOUNT_DELETE, 21, AccountDelete,
|
||||
Delegation::notDelegable,
|
||||
@@ -309,7 +309,7 @@ TRANSACTION(ttACCOUNT_DELETE, 21, AccountDelete,
|
||||
|
||||
/** This transaction mints a new NFT. */
|
||||
#if TRANSACTION_INCLUDE
|
||||
# include <xrpl/tx/transactors/nft/NFTokenMint.h>
|
||||
# include <xrpl/tx/transactors/NFT/NFTokenMint.h>
|
||||
#endif
|
||||
TRANSACTION(ttNFTOKEN_MINT, 25, NFTokenMint,
|
||||
Delegation::delegable,
|
||||
@@ -327,7 +327,7 @@ TRANSACTION(ttNFTOKEN_MINT, 25, NFTokenMint,
|
||||
|
||||
/** This transaction burns (i.e. destroys) an existing NFT. */
|
||||
#if TRANSACTION_INCLUDE
|
||||
# include <xrpl/tx/transactors/nft/NFTokenBurn.h>
|
||||
# include <xrpl/tx/transactors/NFT/NFTokenBurn.h>
|
||||
#endif
|
||||
TRANSACTION(ttNFTOKEN_BURN, 26, NFTokenBurn,
|
||||
Delegation::delegable,
|
||||
@@ -340,7 +340,7 @@ TRANSACTION(ttNFTOKEN_BURN, 26, NFTokenBurn,
|
||||
|
||||
/** This transaction creates a new offer to buy or sell an NFT. */
|
||||
#if TRANSACTION_INCLUDE
|
||||
# include <xrpl/tx/transactors/nft/NFTokenCreateOffer.h>
|
||||
# include <xrpl/tx/transactors/NFT/NFTokenCreateOffer.h>
|
||||
#endif
|
||||
TRANSACTION(ttNFTOKEN_CREATE_OFFER, 27, NFTokenCreateOffer,
|
||||
Delegation::delegable,
|
||||
@@ -356,7 +356,7 @@ TRANSACTION(ttNFTOKEN_CREATE_OFFER, 27, NFTokenCreateOffer,
|
||||
|
||||
/** This transaction cancels an existing offer to buy or sell an existing NFT. */
|
||||
#if TRANSACTION_INCLUDE
|
||||
# include <xrpl/tx/transactors/nft/NFTokenCancelOffer.h>
|
||||
# include <xrpl/tx/transactors/NFT/NFTokenCancelOffer.h>
|
||||
#endif
|
||||
TRANSACTION(ttNFTOKEN_CANCEL_OFFER, 28, NFTokenCancelOffer,
|
||||
Delegation::delegable,
|
||||
@@ -368,7 +368,7 @@ TRANSACTION(ttNFTOKEN_CANCEL_OFFER, 28, NFTokenCancelOffer,
|
||||
|
||||
/** This transaction accepts an existing offer to buy or sell an existing NFT. */
|
||||
#if TRANSACTION_INCLUDE
|
||||
# include <xrpl/tx/transactors/nft/NFTokenAcceptOffer.h>
|
||||
# include <xrpl/tx/transactors/NFT/NFTokenAcceptOffer.h>
|
||||
#endif
|
||||
TRANSACTION(ttNFTOKEN_ACCEPT_OFFER, 29, NFTokenAcceptOffer,
|
||||
Delegation::delegable,
|
||||
@@ -382,7 +382,7 @@ TRANSACTION(ttNFTOKEN_ACCEPT_OFFER, 29, NFTokenAcceptOffer,
|
||||
|
||||
/** This transaction claws back issued tokens. */
|
||||
#if TRANSACTION_INCLUDE
|
||||
# include <xrpl/tx/transactors/token/Clawback.h>
|
||||
# include <xrpl/tx/transactors/Clawback.h>
|
||||
#endif
|
||||
TRANSACTION(ttCLAWBACK, 30, Clawback,
|
||||
Delegation::delegable,
|
||||
@@ -395,7 +395,7 @@ TRANSACTION(ttCLAWBACK, 30, Clawback,
|
||||
|
||||
/** This transaction claws back tokens from an AMM pool. */
|
||||
#if TRANSACTION_INCLUDE
|
||||
# include <xrpl/tx/transactors/dex/AMMClawback.h>
|
||||
# include <xrpl/tx/transactors/AMM/AMMClawback.h>
|
||||
#endif
|
||||
TRANSACTION(ttAMM_CLAWBACK, 31, AMMClawback,
|
||||
Delegation::delegable,
|
||||
@@ -410,7 +410,7 @@ TRANSACTION(ttAMM_CLAWBACK, 31, AMMClawback,
|
||||
|
||||
/** This transaction type creates an AMM instance */
|
||||
#if TRANSACTION_INCLUDE
|
||||
# include <xrpl/tx/transactors/dex/AMMCreate.h>
|
||||
# include <xrpl/tx/transactors/AMM/AMMCreate.h>
|
||||
#endif
|
||||
TRANSACTION(ttAMM_CREATE, 35, AMMCreate,
|
||||
Delegation::delegable,
|
||||
@@ -424,7 +424,7 @@ TRANSACTION(ttAMM_CREATE, 35, AMMCreate,
|
||||
|
||||
/** This transaction type deposits into an AMM instance */
|
||||
#if TRANSACTION_INCLUDE
|
||||
# include <xrpl/tx/transactors/dex/AMMDeposit.h>
|
||||
# include <xrpl/tx/transactors/AMM/AMMDeposit.h>
|
||||
#endif
|
||||
TRANSACTION(ttAMM_DEPOSIT, 36, AMMDeposit,
|
||||
Delegation::delegable,
|
||||
@@ -442,7 +442,7 @@ TRANSACTION(ttAMM_DEPOSIT, 36, AMMDeposit,
|
||||
|
||||
/** This transaction type withdraws from an AMM instance */
|
||||
#if TRANSACTION_INCLUDE
|
||||
# include <xrpl/tx/transactors/dex/AMMWithdraw.h>
|
||||
# include <xrpl/tx/transactors/AMM/AMMWithdraw.h>
|
||||
#endif
|
||||
TRANSACTION(ttAMM_WITHDRAW, 37, AMMWithdraw,
|
||||
Delegation::delegable,
|
||||
@@ -459,7 +459,7 @@ TRANSACTION(ttAMM_WITHDRAW, 37, AMMWithdraw,
|
||||
|
||||
/** This transaction type votes for the trading fee */
|
||||
#if TRANSACTION_INCLUDE
|
||||
# include <xrpl/tx/transactors/dex/AMMVote.h>
|
||||
# include <xrpl/tx/transactors/AMM/AMMVote.h>
|
||||
#endif
|
||||
TRANSACTION(ttAMM_VOTE, 38, AMMVote,
|
||||
Delegation::delegable,
|
||||
@@ -473,7 +473,7 @@ TRANSACTION(ttAMM_VOTE, 38, AMMVote,
|
||||
|
||||
/** This transaction type bids for the auction slot */
|
||||
#if TRANSACTION_INCLUDE
|
||||
# include <xrpl/tx/transactors/dex/AMMBid.h>
|
||||
# include <xrpl/tx/transactors/AMM/AMMBid.h>
|
||||
#endif
|
||||
TRANSACTION(ttAMM_BID, 39, AMMBid,
|
||||
Delegation::delegable,
|
||||
@@ -489,7 +489,7 @@ TRANSACTION(ttAMM_BID, 39, AMMBid,
|
||||
|
||||
/** This transaction type deletes AMM in the empty state */
|
||||
#if TRANSACTION_INCLUDE
|
||||
# include <xrpl/tx/transactors/dex/AMMDelete.h>
|
||||
# include <xrpl/tx/transactors/AMM/AMMDelete.h>
|
||||
#endif
|
||||
TRANSACTION(ttAMM_DELETE, 40, AMMDelete,
|
||||
Delegation::delegable,
|
||||
@@ -502,7 +502,7 @@ TRANSACTION(ttAMM_DELETE, 40, AMMDelete,
|
||||
|
||||
/** This transactions creates a crosschain sequence number */
|
||||
#if TRANSACTION_INCLUDE
|
||||
# include <xrpl/tx/transactors/bridge/XChainBridge.h>
|
||||
# include <xrpl/tx/transactors/XChainBridge.h>
|
||||
#endif
|
||||
TRANSACTION(ttXCHAIN_CREATE_CLAIM_ID, 41, XChainCreateClaimID,
|
||||
Delegation::delegable,
|
||||
@@ -617,7 +617,7 @@ TRANSACTION(ttXCHAIN_CREATE_BRIDGE, 48, XChainCreateBridge,
|
||||
|
||||
/** This transaction type creates or updates a DID */
|
||||
#if TRANSACTION_INCLUDE
|
||||
# include <xrpl/tx/transactors/did/DID.h>
|
||||
# include <xrpl/tx/transactors/DID.h>
|
||||
#endif
|
||||
TRANSACTION(ttDID_SET, 49, DIDSet,
|
||||
Delegation::delegable,
|
||||
@@ -638,7 +638,7 @@ TRANSACTION(ttDID_DELETE, 50, DIDDelete,
|
||||
|
||||
/** This transaction type creates an Oracle instance */
|
||||
#if TRANSACTION_INCLUDE
|
||||
# include <xrpl/tx/transactors/oracle/SetOracle.h>
|
||||
# include <xrpl/tx/transactors/SetOracle.h>
|
||||
#endif
|
||||
TRANSACTION(ttORACLE_SET, 51, OracleSet,
|
||||
Delegation::delegable,
|
||||
@@ -655,7 +655,7 @@ TRANSACTION(ttORACLE_SET, 51, OracleSet,
|
||||
|
||||
/** This transaction type deletes an Oracle instance */
|
||||
#if TRANSACTION_INCLUDE
|
||||
# include <xrpl/tx/transactors/oracle/DeleteOracle.h>
|
||||
# include <xrpl/tx/transactors/DeleteOracle.h>
|
||||
#endif
|
||||
TRANSACTION(ttORACLE_DELETE, 52, OracleDelete,
|
||||
Delegation::delegable,
|
||||
@@ -667,7 +667,7 @@ TRANSACTION(ttORACLE_DELETE, 52, OracleDelete,
|
||||
|
||||
/** This transaction type fixes a problem in the ledger state */
|
||||
#if TRANSACTION_INCLUDE
|
||||
# include <xrpl/tx/transactors/system/LedgerStateFix.h>
|
||||
# include <xrpl/tx/transactors/LedgerStateFix.h>
|
||||
#endif
|
||||
TRANSACTION(ttLEDGER_STATE_FIX, 53, LedgerStateFix,
|
||||
Delegation::delegable,
|
||||
@@ -680,7 +680,7 @@ TRANSACTION(ttLEDGER_STATE_FIX, 53, LedgerStateFix,
|
||||
|
||||
/** This transaction type creates a MPTokensIssuance instance */
|
||||
#if TRANSACTION_INCLUDE
|
||||
# include <xrpl/tx/transactors/token/MPTokenIssuanceCreate.h>
|
||||
# include <xrpl/tx/transactors/MPT/MPTokenIssuanceCreate.h>
|
||||
#endif
|
||||
TRANSACTION(ttMPTOKEN_ISSUANCE_CREATE, 54, MPTokenIssuanceCreate,
|
||||
Delegation::delegable,
|
||||
@@ -697,7 +697,7 @@ TRANSACTION(ttMPTOKEN_ISSUANCE_CREATE, 54, MPTokenIssuanceCreate,
|
||||
|
||||
/** This transaction type destroys a MPTokensIssuance instance */
|
||||
#if TRANSACTION_INCLUDE
|
||||
# include <xrpl/tx/transactors/token/MPTokenIssuanceDestroy.h>
|
||||
# include <xrpl/tx/transactors/MPT/MPTokenIssuanceDestroy.h>
|
||||
#endif
|
||||
TRANSACTION(ttMPTOKEN_ISSUANCE_DESTROY, 55, MPTokenIssuanceDestroy,
|
||||
Delegation::delegable,
|
||||
@@ -709,7 +709,7 @@ TRANSACTION(ttMPTOKEN_ISSUANCE_DESTROY, 55, MPTokenIssuanceDestroy,
|
||||
|
||||
/** This transaction type sets flags on a MPTokensIssuance or MPToken instance */
|
||||
#if TRANSACTION_INCLUDE
|
||||
# include <xrpl/tx/transactors/token/MPTokenIssuanceSet.h>
|
||||
# include <xrpl/tx/transactors/MPT/MPTokenIssuanceSet.h>
|
||||
#endif
|
||||
TRANSACTION(ttMPTOKEN_ISSUANCE_SET, 56, MPTokenIssuanceSet,
|
||||
Delegation::delegable,
|
||||
@@ -726,7 +726,7 @@ TRANSACTION(ttMPTOKEN_ISSUANCE_SET, 56, MPTokenIssuanceSet,
|
||||
|
||||
/** This transaction type authorizes a MPToken instance */
|
||||
#if TRANSACTION_INCLUDE
|
||||
# include <xrpl/tx/transactors/token/MPTokenAuthorize.h>
|
||||
# include <xrpl/tx/transactors/MPT/MPTokenAuthorize.h>
|
||||
#endif
|
||||
TRANSACTION(ttMPTOKEN_AUTHORIZE, 57, MPTokenAuthorize,
|
||||
Delegation::delegable,
|
||||
@@ -739,7 +739,7 @@ TRANSACTION(ttMPTOKEN_AUTHORIZE, 57, MPTokenAuthorize,
|
||||
|
||||
/** This transaction type create an Credential instance */
|
||||
#if TRANSACTION_INCLUDE
|
||||
# include <xrpl/tx/transactors/credentials/Credentials.h>
|
||||
# include <xrpl/tx/transactors/Credentials.h>
|
||||
#endif
|
||||
TRANSACTION(ttCREDENTIAL_CREATE, 58, CredentialCreate,
|
||||
Delegation::delegable,
|
||||
@@ -775,7 +775,7 @@ TRANSACTION(ttCREDENTIAL_DELETE, 60, CredentialDelete,
|
||||
|
||||
/** This transaction type modify a NFToken */
|
||||
#if TRANSACTION_INCLUDE
|
||||
# include <xrpl/tx/transactors/nft/NFTokenModify.h>
|
||||
# include <xrpl/tx/transactors/NFT/NFTokenModify.h>
|
||||
#endif
|
||||
TRANSACTION(ttNFTOKEN_MODIFY, 61, NFTokenModify,
|
||||
Delegation::delegable,
|
||||
@@ -789,7 +789,7 @@ TRANSACTION(ttNFTOKEN_MODIFY, 61, NFTokenModify,
|
||||
|
||||
/** This transaction type creates or modifies a Permissioned Domain */
|
||||
#if TRANSACTION_INCLUDE
|
||||
# include <xrpl/tx/transactors/permissioned_domain/PermissionedDomainSet.h>
|
||||
# include <xrpl/tx/transactors/PermissionedDomain/PermissionedDomainSet.h>
|
||||
#endif
|
||||
TRANSACTION(ttPERMISSIONED_DOMAIN_SET, 62, PermissionedDomainSet,
|
||||
Delegation::delegable,
|
||||
@@ -802,7 +802,7 @@ TRANSACTION(ttPERMISSIONED_DOMAIN_SET, 62, PermissionedDomainSet,
|
||||
|
||||
/** This transaction type deletes a Permissioned Domain */
|
||||
#if TRANSACTION_INCLUDE
|
||||
# include <xrpl/tx/transactors/permissioned_domain/PermissionedDomainDelete.h>
|
||||
# include <xrpl/tx/transactors/PermissionedDomain/PermissionedDomainDelete.h>
|
||||
#endif
|
||||
TRANSACTION(ttPERMISSIONED_DOMAIN_DELETE, 63, PermissionedDomainDelete,
|
||||
Delegation::delegable,
|
||||
@@ -814,7 +814,7 @@ TRANSACTION(ttPERMISSIONED_DOMAIN_DELETE, 63, PermissionedDomainDelete,
|
||||
|
||||
/** This transaction type delegates authorized account specified permissions */
|
||||
#if TRANSACTION_INCLUDE
|
||||
# include <xrpl/tx/transactors/delegate/DelegateSet.h>
|
||||
# include <xrpl/tx/transactors/Delegate/DelegateSet.h>
|
||||
#endif
|
||||
TRANSACTION(ttDELEGATE_SET, 64, DelegateSet,
|
||||
Delegation::notDelegable,
|
||||
@@ -827,7 +827,7 @@ TRANSACTION(ttDELEGATE_SET, 64, DelegateSet,
|
||||
|
||||
/** This transaction creates a single asset vault. */
|
||||
#if TRANSACTION_INCLUDE
|
||||
# include <xrpl/tx/transactors/vault/VaultCreate.h>
|
||||
# include <xrpl/tx/transactors/Vault/VaultCreate.h>
|
||||
#endif
|
||||
TRANSACTION(ttVAULT_CREATE, 65, VaultCreate,
|
||||
Delegation::delegable,
|
||||
@@ -845,7 +845,7 @@ TRANSACTION(ttVAULT_CREATE, 65, VaultCreate,
|
||||
|
||||
/** This transaction updates a single asset vault. */
|
||||
#if TRANSACTION_INCLUDE
|
||||
# include <xrpl/tx/transactors/vault/VaultSet.h>
|
||||
# include <xrpl/tx/transactors/Vault/VaultSet.h>
|
||||
#endif
|
||||
TRANSACTION(ttVAULT_SET, 66, VaultSet,
|
||||
Delegation::delegable,
|
||||
@@ -860,7 +860,7 @@ TRANSACTION(ttVAULT_SET, 66, VaultSet,
|
||||
|
||||
/** This transaction deletes a single asset vault. */
|
||||
#if TRANSACTION_INCLUDE
|
||||
# include <xrpl/tx/transactors/vault/VaultDelete.h>
|
||||
# include <xrpl/tx/transactors/Vault/VaultDelete.h>
|
||||
#endif
|
||||
TRANSACTION(ttVAULT_DELETE, 67, VaultDelete,
|
||||
Delegation::delegable,
|
||||
@@ -872,7 +872,7 @@ TRANSACTION(ttVAULT_DELETE, 67, VaultDelete,
|
||||
|
||||
/** This transaction trades assets for shares with a vault. */
|
||||
#if TRANSACTION_INCLUDE
|
||||
# include <xrpl/tx/transactors/vault/VaultDeposit.h>
|
||||
# include <xrpl/tx/transactors/Vault/VaultDeposit.h>
|
||||
#endif
|
||||
TRANSACTION(ttVAULT_DEPOSIT, 68, VaultDeposit,
|
||||
Delegation::delegable,
|
||||
@@ -885,7 +885,7 @@ TRANSACTION(ttVAULT_DEPOSIT, 68, VaultDeposit,
|
||||
|
||||
/** This transaction trades shares for assets with a vault. */
|
||||
#if TRANSACTION_INCLUDE
|
||||
# include <xrpl/tx/transactors/vault/VaultWithdraw.h>
|
||||
# include <xrpl/tx/transactors/Vault/VaultWithdraw.h>
|
||||
#endif
|
||||
TRANSACTION(ttVAULT_WITHDRAW, 69, VaultWithdraw,
|
||||
Delegation::delegable,
|
||||
@@ -900,7 +900,7 @@ TRANSACTION(ttVAULT_WITHDRAW, 69, VaultWithdraw,
|
||||
|
||||
/** This transaction claws back tokens from a vault. */
|
||||
#if TRANSACTION_INCLUDE
|
||||
# include <xrpl/tx/transactors/vault/VaultClawback.h>
|
||||
# include <xrpl/tx/transactors/Vault/VaultClawback.h>
|
||||
#endif
|
||||
TRANSACTION(ttVAULT_CLAWBACK, 70, VaultClawback,
|
||||
Delegation::delegable,
|
||||
@@ -914,7 +914,7 @@ TRANSACTION(ttVAULT_CLAWBACK, 70, VaultClawback,
|
||||
|
||||
/** This transaction type batches together transactions. */
|
||||
#if TRANSACTION_INCLUDE
|
||||
# include <xrpl/tx/transactors/system/Batch.h>
|
||||
# include <xrpl/tx/transactors/Batch.h>
|
||||
#endif
|
||||
TRANSACTION(ttBATCH, 71, Batch,
|
||||
Delegation::notDelegable,
|
||||
@@ -929,7 +929,7 @@ TRANSACTION(ttBATCH, 71, Batch,
|
||||
|
||||
/** This transaction creates and updates a Loan Broker */
|
||||
#if TRANSACTION_INCLUDE
|
||||
# include <xrpl/tx/transactors/lending/LoanBrokerSet.h>
|
||||
# include <xrpl/tx/transactors/Lending/LoanBrokerSet.h>
|
||||
#endif
|
||||
TRANSACTION(ttLOAN_BROKER_SET, 74, LoanBrokerSet,
|
||||
Delegation::delegable,
|
||||
@@ -946,7 +946,7 @@ TRANSACTION(ttLOAN_BROKER_SET, 74, LoanBrokerSet,
|
||||
|
||||
/** This transaction deletes a Loan Broker */
|
||||
#if TRANSACTION_INCLUDE
|
||||
# include <xrpl/tx/transactors/lending/LoanBrokerDelete.h>
|
||||
# include <xrpl/tx/transactors/Lending/LoanBrokerDelete.h>
|
||||
#endif
|
||||
TRANSACTION(ttLOAN_BROKER_DELETE, 75, LoanBrokerDelete,
|
||||
Delegation::delegable,
|
||||
@@ -957,7 +957,7 @@ TRANSACTION(ttLOAN_BROKER_DELETE, 75, LoanBrokerDelete,
|
||||
|
||||
/** This transaction deposits First Loss Capital into a Loan Broker */
|
||||
#if TRANSACTION_INCLUDE
|
||||
# include <xrpl/tx/transactors/lending/LoanBrokerCoverDeposit.h>
|
||||
# include <xrpl/tx/transactors/Lending/LoanBrokerCoverDeposit.h>
|
||||
#endif
|
||||
TRANSACTION(ttLOAN_BROKER_COVER_DEPOSIT, 76, LoanBrokerCoverDeposit,
|
||||
Delegation::delegable,
|
||||
@@ -969,7 +969,7 @@ TRANSACTION(ttLOAN_BROKER_COVER_DEPOSIT, 76, LoanBrokerCoverDeposit,
|
||||
|
||||
/** This transaction withdraws First Loss Capital from a Loan Broker */
|
||||
#if TRANSACTION_INCLUDE
|
||||
# include <xrpl/tx/transactors/lending/LoanBrokerCoverWithdraw.h>
|
||||
# include <xrpl/tx/transactors/Lending/LoanBrokerCoverWithdraw.h>
|
||||
#endif
|
||||
TRANSACTION(ttLOAN_BROKER_COVER_WITHDRAW, 77, LoanBrokerCoverWithdraw,
|
||||
Delegation::delegable,
|
||||
@@ -984,7 +984,7 @@ TRANSACTION(ttLOAN_BROKER_COVER_WITHDRAW, 77, LoanBrokerCoverWithdraw,
|
||||
/** This transaction claws back First Loss Capital from a Loan Broker to
|
||||
the issuer of the capital */
|
||||
#if TRANSACTION_INCLUDE
|
||||
# include <xrpl/tx/transactors/lending/LoanBrokerCoverClawback.h>
|
||||
# include <xrpl/tx/transactors/Lending/LoanBrokerCoverClawback.h>
|
||||
#endif
|
||||
TRANSACTION(ttLOAN_BROKER_COVER_CLAWBACK, 78, LoanBrokerCoverClawback,
|
||||
Delegation::delegable,
|
||||
@@ -996,7 +996,7 @@ TRANSACTION(ttLOAN_BROKER_COVER_CLAWBACK, 78, LoanBrokerCoverClawback,
|
||||
|
||||
/** This transaction creates a Loan */
|
||||
#if TRANSACTION_INCLUDE
|
||||
# include <xrpl/tx/transactors/lending/LoanSet.h>
|
||||
# include <xrpl/tx/transactors/Lending/LoanSet.h>
|
||||
#endif
|
||||
TRANSACTION(ttLOAN_SET, 80, LoanSet,
|
||||
Delegation::delegable,
|
||||
@@ -1023,7 +1023,7 @@ TRANSACTION(ttLOAN_SET, 80, LoanSet,
|
||||
|
||||
/** This transaction deletes an existing Loan */
|
||||
#if TRANSACTION_INCLUDE
|
||||
# include <xrpl/tx/transactors/lending/LoanDelete.h>
|
||||
# include <xrpl/tx/transactors/Lending/LoanDelete.h>
|
||||
#endif
|
||||
TRANSACTION(ttLOAN_DELETE, 81, LoanDelete,
|
||||
Delegation::delegable,
|
||||
@@ -1034,7 +1034,7 @@ TRANSACTION(ttLOAN_DELETE, 81, LoanDelete,
|
||||
|
||||
/** This transaction is used to change the delinquency status of an existing Loan */
|
||||
#if TRANSACTION_INCLUDE
|
||||
# include <xrpl/tx/transactors/lending/LoanManage.h>
|
||||
# include <xrpl/tx/transactors/Lending/LoanManage.h>
|
||||
#endif
|
||||
TRANSACTION(ttLOAN_MANAGE, 82, LoanManage,
|
||||
Delegation::delegable,
|
||||
@@ -1048,7 +1048,7 @@ TRANSACTION(ttLOAN_MANAGE, 82, LoanManage,
|
||||
|
||||
/** The Borrower uses this transaction to make a Payment on the Loan. */
|
||||
#if TRANSACTION_INCLUDE
|
||||
# include <xrpl/tx/transactors/lending/LoanPay.h>
|
||||
# include <xrpl/tx/transactors/Lending/LoanPay.h>
|
||||
#endif
|
||||
TRANSACTION(ttLOAN_PAY, 84, LoanPay,
|
||||
Delegation::delegable,
|
||||
@@ -1063,7 +1063,7 @@ TRANSACTION(ttLOAN_PAY, 84, LoanPay,
|
||||
For details, see: https://xrpl.org/amendments.html
|
||||
*/
|
||||
#if TRANSACTION_INCLUDE
|
||||
# include <xrpl/tx/transactors/system/Change.h>
|
||||
# include <xrpl/tx/transactors/Change.h>
|
||||
#endif
|
||||
TRANSACTION(ttAMENDMENT, 100, EnableAmendment,
|
||||
Delegation::notDelegable,
|
||||
|
||||
@@ -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() const
|
||||
{
|
||||
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,82 +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)
|
||||
{
|
||||
auto entryType = static_cast<LedgerEntryType>(ledgerEntryType);
|
||||
auto const& soTemplate =
|
||||
LedgerFormats::getInstance().findByType(entryType)->getSOTemplate();
|
||||
object_.set(soTemplate);
|
||||
object_[sfLedgerEntryType] = ledgerEntryType;
|
||||
object_[sfFlags] = flags;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Validate the ledger entry
|
||||
* @return true if validation passes, false otherwise
|
||||
*/
|
||||
[[nodiscard]]
|
||||
bool
|
||||
validate() const
|
||||
{
|
||||
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,123 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <utility>
|
||||
|
||||
namespace xrpl::protocol_autogen {
|
||||
|
||||
/**
|
||||
* A wrapper that owns an object and provides access through a typed wrapper.
|
||||
*
|
||||
* This is useful when you want to hold both the raw underlying object (like SLE or STTx)
|
||||
* and its type-safe wrapper together with proper ownership semantics.
|
||||
*
|
||||
* The class is non-copyable and non-movable because the wrapper holds a reference
|
||||
* to the owned object.
|
||||
*
|
||||
* @tparam TObject The underlying object type (e.g., SLE, STTx)
|
||||
* @tparam TWrapper The typed wrapper class (e.g., AccountRoot, Payment)
|
||||
*
|
||||
* Example usage:
|
||||
* @code
|
||||
* // From a builder
|
||||
* auto owned = accountRootBuilder.buildOwning(index);
|
||||
* owned->getBalance(); // Access via typed wrapper
|
||||
* owned.object(); // Access raw SLE
|
||||
*
|
||||
* // Direct construction
|
||||
* Owning<SLE, AccountRoot> owned{std::move(sle)};
|
||||
* @endcode
|
||||
*/
|
||||
template <typename TObject, typename TWrapper>
|
||||
class Owning
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Construct by taking ownership of the object.
|
||||
* @param obj The object to own (will be moved from)
|
||||
*/
|
||||
explicit Owning(TObject obj) : object_(std::move(obj)), wrapper_(object_)
|
||||
{
|
||||
}
|
||||
|
||||
// Non-copyable and non-movable (wrapper holds reference to object_)
|
||||
Owning(Owning const&) = delete;
|
||||
Owning&
|
||||
operator=(Owning const&) = delete;
|
||||
Owning(Owning&&) = delete;
|
||||
Owning&
|
||||
operator=(Owning&&) = delete;
|
||||
|
||||
/**
|
||||
* Access the typed wrapper.
|
||||
*/
|
||||
[[nodiscard]]
|
||||
TWrapper&
|
||||
get()
|
||||
{
|
||||
return wrapper_;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
TWrapper const&
|
||||
get() const
|
||||
{
|
||||
return wrapper_;
|
||||
}
|
||||
|
||||
/**
|
||||
* Dereference to access the wrapper.
|
||||
*/
|
||||
[[nodiscard]]
|
||||
TWrapper&
|
||||
operator*()
|
||||
{
|
||||
return wrapper_;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
TWrapper const&
|
||||
operator*() const
|
||||
{
|
||||
return wrapper_;
|
||||
}
|
||||
|
||||
/**
|
||||
* Arrow operator for convenient wrapper access.
|
||||
*/
|
||||
[[nodiscard]]
|
||||
TWrapper*
|
||||
operator->()
|
||||
{
|
||||
return &wrapper_;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
TWrapper const*
|
||||
operator->() const
|
||||
{
|
||||
return &wrapper_;
|
||||
}
|
||||
|
||||
/**
|
||||
* Access the underlying object directly.
|
||||
*/
|
||||
[[nodiscard]]
|
||||
TObject&
|
||||
object()
|
||||
{
|
||||
return object_;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
TObject const&
|
||||
object() const
|
||||
{
|
||||
return object_;
|
||||
}
|
||||
|
||||
private:
|
||||
TObject object_; // Must be declared first (initialised first)
|
||||
TWrapper wrapper_; // Holds reference to object_
|
||||
};
|
||||
|
||||
} // namespace xrpl::protocol_autogen
|
||||
@@ -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,43 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/SOTemplate.h>
|
||||
#include <xrpl/protocol/STObject.h>
|
||||
|
||||
namespace xrpl::protocol_autogen {
|
||||
|
||||
[[nodiscard]]
|
||||
inline 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() == soeMPTNotSupported && obj.isFieldPresent(field.sField()))
|
||||
{
|
||||
if (field.sField().fieldType == STI_AMOUNT)
|
||||
{
|
||||
auto const& amount = obj.getFieldAmount(field.sField());
|
||||
|
||||
if (amount.asset().holds<MPTIssue>())
|
||||
return false;
|
||||
}
|
||||
else if (field.sField().fieldType == STI_ISSUE)
|
||||
{
|
||||
auto issue = dynamic_cast<STIssue const*>(obj.peekAtPField(field.sField()));
|
||||
if (!issue)
|
||||
return false;
|
||||
|
||||
if (issue->holds<MPTIssue>())
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace xrpl::protocol_autogen
|
||||
@@ -1,455 +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(std::string& reason) const
|
||||
{
|
||||
if (!protocol_autogen::validateSTObject(
|
||||
tx_, TxFormats::getInstance().findByType(tx_.getTxnType())->getSOTemplate()))
|
||||
{
|
||||
reason = "Transaction failed schema validation";
|
||||
return false;
|
||||
}
|
||||
|
||||
// Pseudo transactions are not submitted to the network
|
||||
if (isPseudoTx(tx_))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return passesLocalChecks(tx_, reason);
|
||||
}
|
||||
|
||||
/**
|
||||
* @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,199 +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/STTx.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)
|
||||
{
|
||||
auto txType = static_cast<TxType>(transactionType);
|
||||
auto const& soTemplate = TxFormats::getInstance().findByType(txType)->getSOTemplate();
|
||||
object_.set(soTemplate);
|
||||
|
||||
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(std::string& reason) const
|
||||
{
|
||||
if (!object_.isFieldPresent(sfTransactionType))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
auto transactionType = static_cast<TxType>(object_.getFieldU16(sfTransactionType));
|
||||
if (!protocol_autogen::validateSTObject(
|
||||
object_, TxFormats::getInstance().findByType(transactionType)->getSOTemplate()))
|
||||
{
|
||||
reason = "Transaction failed schema validation";
|
||||
return false;
|
||||
}
|
||||
|
||||
// Pseudo transactions are not submitted to the network
|
||||
if (isPseudoTx(object_))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return passesLocalChecks(object_, reason);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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);
|
||||
}
|
||||
|
||||
protected:
|
||||
/**
|
||||
* 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);
|
||||
}
|
||||
|
||||
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,348 +0,0 @@
|
||||
// This file is auto-generated. Do not edit.
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STLedgerEntry.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/Owning.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.
|
||||
*/
|
||||
protocol_autogen::Owning<SLE, AMM>
|
||||
build(uint256 const& index)
|
||||
{
|
||||
return protocol_autogen::Owning<SLE, AMM>{SLE{object_, index}};
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::ledger_entries
|
||||
@@ -1,728 +0,0 @@
|
||||
// This file is auto-generated. Do not edit.
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STLedgerEntry.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/Owning.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.
|
||||
*/
|
||||
protocol_autogen::Owning<SLE, AccountRoot>
|
||||
build(uint256 const& index)
|
||||
{
|
||||
return protocol_autogen::Owning<SLE, AccountRoot>{SLE{object_, index}};
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::ledger_entries
|
||||
@@ -1,207 +0,0 @@
|
||||
// This file is auto-generated. Do not edit.
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STLedgerEntry.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/Owning.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.
|
||||
*/
|
||||
protocol_autogen::Owning<SLE, Amendments>
|
||||
build(uint256 const& index)
|
||||
{
|
||||
return protocol_autogen::Owning<SLE, Amendments>{SLE{object_, index}};
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::ledger_entries
|
||||
@@ -1,314 +0,0 @@
|
||||
// This file is auto-generated. Do not edit.
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STLedgerEntry.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/Owning.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.
|
||||
*/
|
||||
protocol_autogen::Owning<SLE, Bridge>
|
||||
build(uint256 const& index)
|
||||
{
|
||||
return protocol_autogen::Owning<SLE, Bridge>{SLE{object_, index}};
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::ledger_entries
|
||||
@@ -1,382 +0,0 @@
|
||||
// This file is auto-generated. Do not edit.
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STLedgerEntry.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/Owning.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.
|
||||
*/
|
||||
protocol_autogen::Owning<SLE, Check>
|
||||
build(uint256 const& index)
|
||||
{
|
||||
return protocol_autogen::Owning<SLE, Check>{SLE{object_, index}};
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::ledger_entries
|
||||
@@ -1,308 +0,0 @@
|
||||
// This file is auto-generated. Do not edit.
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STLedgerEntry.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/Owning.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.
|
||||
*/
|
||||
protocol_autogen::Owning<SLE, Credential>
|
||||
build(uint256 const& index)
|
||||
{
|
||||
return protocol_autogen::Owning<SLE, Credential>{SLE{object_, index}};
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::ledger_entries
|
||||
@@ -1,264 +0,0 @@
|
||||
// This file is auto-generated. Do not edit.
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STLedgerEntry.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/Owning.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.
|
||||
*/
|
||||
protocol_autogen::Owning<SLE, DID>
|
||||
build(uint256 const& index)
|
||||
{
|
||||
return protocol_autogen::Owning<SLE, DID>{SLE{object_, index}};
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::ledger_entries
|
||||
@@ -1,219 +0,0 @@
|
||||
// This file is auto-generated. Do not edit.
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STLedgerEntry.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/Owning.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.
|
||||
*/
|
||||
protocol_autogen::Owning<SLE, Delegate>
|
||||
build(uint256 const& index)
|
||||
{
|
||||
return protocol_autogen::Owning<SLE, Delegate>{SLE{object_, index}};
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::ledger_entries
|
||||
@@ -1,235 +0,0 @@
|
||||
// This file is auto-generated. Do not edit.
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STLedgerEntry.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/Owning.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.
|
||||
*/
|
||||
protocol_autogen::Owning<SLE, DepositPreauth>
|
||||
build(uint256 const& index)
|
||||
{
|
||||
return protocol_autogen::Owning<SLE, DepositPreauth>{SLE{object_, index}};
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::ledger_entries
|
||||
@@ -1,490 +0,0 @@
|
||||
// This file is auto-generated. Do not edit.
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STLedgerEntry.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/Owning.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.
|
||||
*/
|
||||
protocol_autogen::Owning<SLE, DirectoryNode>
|
||||
build(uint256 const& index)
|
||||
{
|
||||
return protocol_autogen::Owning<SLE, DirectoryNode>{SLE{object_, index}};
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::ledger_entries
|
||||
@@ -1,488 +0,0 @@
|
||||
// This file is auto-generated. Do not edit.
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STLedgerEntry.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/Owning.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.
|
||||
*/
|
||||
protocol_autogen::Owning<SLE, Escrow>
|
||||
build(uint256 const& index)
|
||||
{
|
||||
return protocol_autogen::Owning<SLE, Escrow>{SLE{object_, index}};
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::ledger_entries
|
||||
@@ -1,356 +0,0 @@
|
||||
// This file is auto-generated. Do not edit.
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STLedgerEntry.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/Owning.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.
|
||||
*/
|
||||
protocol_autogen::Owning<SLE, FeeSettings>
|
||||
build(uint256 const& index)
|
||||
{
|
||||
return protocol_autogen::Owning<SLE, FeeSettings>{SLE{object_, index}};
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::ledger_entries
|
||||
@@ -1,168 +0,0 @@
|
||||
// This file is auto-generated. Do not edit.
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STLedgerEntry.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/Owning.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.
|
||||
*/
|
||||
protocol_autogen::Owning<SLE, LedgerHashes>
|
||||
build(uint256 const& index)
|
||||
{
|
||||
return protocol_autogen::Owning<SLE, LedgerHashes>{SLE{object_, index}};
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::ledger_entries
|
||||
@@ -1,816 +0,0 @@
|
||||
// This file is auto-generated. Do not edit.
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STLedgerEntry.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/Owning.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.
|
||||
*/
|
||||
protocol_autogen::Owning<SLE, Loan>
|
||||
build(uint256 const& index)
|
||||
{
|
||||
return protocol_autogen::Owning<SLE, Loan>{SLE{object_, index}};
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::ledger_entries
|
||||
@@ -1,524 +0,0 @@
|
||||
// This file is auto-generated. Do not edit.
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STLedgerEntry.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/Owning.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.
|
||||
*/
|
||||
protocol_autogen::Owning<SLE, LoanBroker>
|
||||
build(uint256 const& index)
|
||||
{
|
||||
return protocol_autogen::Owning<SLE, LoanBroker>{SLE{object_, index}};
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::ledger_entries
|
||||
@@ -1,256 +0,0 @@
|
||||
// This file is auto-generated. Do not edit.
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STLedgerEntry.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/Owning.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.
|
||||
*/
|
||||
protocol_autogen::Owning<SLE, MPToken>
|
||||
build(uint256 const& index)
|
||||
{
|
||||
return protocol_autogen::Owning<SLE, MPToken>{SLE{object_, index}};
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::ledger_entries
|
||||
@@ -1,428 +0,0 @@
|
||||
// This file is auto-generated. Do not edit.
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STLedgerEntry.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/Owning.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.
|
||||
*/
|
||||
protocol_autogen::Owning<SLE, MPTokenIssuance>
|
||||
build(uint256 const& index)
|
||||
{
|
||||
return protocol_autogen::Owning<SLE, MPTokenIssuance>{SLE{object_, index}};
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::ledger_entries
|
||||
@@ -1,300 +0,0 @@
|
||||
// This file is auto-generated. Do not edit.
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STLedgerEntry.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/Owning.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.
|
||||
*/
|
||||
protocol_autogen::Owning<SLE, NFTokenOffer>
|
||||
build(uint256 const& index)
|
||||
{
|
||||
return protocol_autogen::Owning<SLE, NFTokenOffer>{SLE{object_, index}};
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::ledger_entries
|
||||
@@ -1,213 +0,0 @@
|
||||
// This file is auto-generated. Do not edit.
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STLedgerEntry.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/Owning.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.
|
||||
*/
|
||||
protocol_autogen::Owning<SLE, NFTokenPage>
|
||||
build(uint256 const& index)
|
||||
{
|
||||
return protocol_autogen::Owning<SLE, NFTokenPage>{SLE{object_, index}};
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::ledger_entries
|
||||
@@ -1,237 +0,0 @@
|
||||
// This file is auto-generated. Do not edit.
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STLedgerEntry.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/Owning.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.
|
||||
*/
|
||||
protocol_autogen::Owning<SLE, NegativeUNL>
|
||||
build(uint256 const& index)
|
||||
{
|
||||
return protocol_autogen::Owning<SLE, NegativeUNL>{SLE{object_, index}};
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::ledger_entries
|
||||
@@ -1,375 +0,0 @@
|
||||
// This file is auto-generated. Do not edit.
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STLedgerEntry.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/Owning.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.
|
||||
*/
|
||||
protocol_autogen::Owning<SLE, Offer>
|
||||
build(uint256 const& index)
|
||||
{
|
||||
return protocol_autogen::Owning<SLE, Offer>{SLE{object_, index}};
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::ledger_entries
|
||||
@@ -1,323 +0,0 @@
|
||||
// This file is auto-generated. Do not edit.
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STLedgerEntry.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/Owning.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.
|
||||
*/
|
||||
protocol_autogen::Owning<SLE, Oracle>
|
||||
build(uint256 const& index)
|
||||
{
|
||||
return protocol_autogen::Owning<SLE, Oracle>{SLE{object_, index}};
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::ledger_entries
|
||||
@@ -1,464 +0,0 @@
|
||||
// This file is auto-generated. Do not edit.
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STLedgerEntry.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/Owning.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.
|
||||
*/
|
||||
protocol_autogen::Owning<SLE, PayChannel>
|
||||
build(uint256 const& index)
|
||||
{
|
||||
return protocol_autogen::Owning<SLE, PayChannel>{SLE{object_, index}};
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::ledger_entries
|
||||
@@ -1,219 +0,0 @@
|
||||
// This file is auto-generated. Do not edit.
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STLedgerEntry.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/Owning.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.
|
||||
*/
|
||||
protocol_autogen::Owning<SLE, PermissionedDomain>
|
||||
build(uint256 const& index)
|
||||
{
|
||||
return protocol_autogen::Owning<SLE, PermissionedDomain>{SLE{object_, index}};
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::ledger_entries
|
||||
@@ -1,376 +0,0 @@
|
||||
// This file is auto-generated. Do not edit.
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STLedgerEntry.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/Owning.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.
|
||||
*/
|
||||
protocol_autogen::Owning<SLE, RippleState>
|
||||
build(uint256 const& index)
|
||||
{
|
||||
return protocol_autogen::Owning<SLE, RippleState>{SLE{object_, index}};
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::ledger_entries
|
||||
@@ -1,249 +0,0 @@
|
||||
// This file is auto-generated. Do not edit.
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STLedgerEntry.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/Owning.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.
|
||||
*/
|
||||
protocol_autogen::Owning<SLE, SignerList>
|
||||
build(uint256 const& index)
|
||||
{
|
||||
return protocol_autogen::Owning<SLE, SignerList>{SLE{object_, index}};
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::ledger_entries
|
||||
@@ -1,196 +0,0 @@
|
||||
// This file is auto-generated. Do not edit.
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STLedgerEntry.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/Owning.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.
|
||||
*/
|
||||
protocol_autogen::Owning<SLE, Ticket>
|
||||
build(uint256 const& index)
|
||||
{
|
||||
return protocol_autogen::Owning<SLE, Ticket>{SLE{object_, index}};
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::ledger_entries
|
||||
@@ -1,464 +0,0 @@
|
||||
// This file is auto-generated. Do not edit.
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STLedgerEntry.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/Owning.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.
|
||||
*/
|
||||
protocol_autogen::Owning<SLE, Vault>
|
||||
build(uint256 const& index)
|
||||
{
|
||||
return protocol_autogen::Owning<SLE, Vault>{SLE{object_, index}};
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::ledger_entries
|
||||
@@ -1,285 +0,0 @@
|
||||
// This file is auto-generated. Do not edit.
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STLedgerEntry.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/Owning.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.
|
||||
*/
|
||||
protocol_autogen::Owning<SLE, XChainOwnedClaimID>
|
||||
build(uint256 const& index)
|
||||
{
|
||||
return protocol_autogen::Owning<SLE, XChainOwnedClaimID>{SLE{object_, index}};
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::ledger_entries
|
||||
@@ -1,241 +0,0 @@
|
||||
// This file is auto-generated. Do not edit.
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STLedgerEntry.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/Owning.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.
|
||||
*/
|
||||
protocol_autogen::Owning<SLE, XChainOwnedCreateAccountClaimID>
|
||||
build(uint256 const& index)
|
||||
{
|
||||
return protocol_autogen::Owning<SLE, XChainOwnedCreateAccountClaimID>{SLE{object_, index}};
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::ledger_entries
|
||||
@@ -1,232 +0,0 @@
|
||||
// This file is auto-generated. Do not edit.
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STTx.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/Owning.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.
|
||||
* @param publicKey The public key for signing
|
||||
* @param secretKey The secret key for signing
|
||||
* @return The constructed transaction wrapper.
|
||||
*/
|
||||
protocol_autogen::Owning<STTx, AMMBid>
|
||||
build(PublicKey const& publicKey, SecretKey const& secretKey)
|
||||
{
|
||||
sign(publicKey, secretKey);
|
||||
return protocol_autogen::Owning<STTx, AMMBid>{STTx{std::move(object_)}};
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::transactions
|
||||
@@ -1,192 +0,0 @@
|
||||
// This file is auto-generated. Do not edit.
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STTx.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/Owning.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.
|
||||
* @param publicKey The public key for signing
|
||||
* @param secretKey The secret key for signing
|
||||
* @return The constructed transaction wrapper.
|
||||
*/
|
||||
protocol_autogen::Owning<STTx, AMMClawback>
|
||||
build(PublicKey const& publicKey, SecretKey const& secretKey)
|
||||
{
|
||||
sign(publicKey, secretKey);
|
||||
return protocol_autogen::Owning<STTx, AMMClawback>{STTx{std::move(object_)}};
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::transactions
|
||||
@@ -1,160 +0,0 @@
|
||||
// This file is auto-generated. Do not edit.
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STTx.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/Owning.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.
|
||||
* @param publicKey The public key for signing
|
||||
* @param secretKey The secret key for signing
|
||||
* @return The constructed transaction wrapper.
|
||||
*/
|
||||
protocol_autogen::Owning<STTx, AMMCreate>
|
||||
build(PublicKey const& publicKey, SecretKey const& secretKey)
|
||||
{
|
||||
sign(publicKey, secretKey);
|
||||
return protocol_autogen::Owning<STTx, AMMCreate>{STTx{std::move(object_)}};
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::transactions
|
||||
@@ -1,138 +0,0 @@
|
||||
// This file is auto-generated. Do not edit.
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STTx.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/Owning.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.
|
||||
* @param publicKey The public key for signing
|
||||
* @param secretKey The secret key for signing
|
||||
* @return The constructed transaction wrapper.
|
||||
*/
|
||||
protocol_autogen::Owning<STTx, AMMDelete>
|
||||
build(PublicKey const& publicKey, SecretKey const& secretKey)
|
||||
{
|
||||
sign(publicKey, secretKey);
|
||||
return protocol_autogen::Owning<STTx, AMMDelete>{STTx{std::move(object_)}};
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::transactions
|
||||
@@ -1,298 +0,0 @@
|
||||
// This file is auto-generated. Do not edit.
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STTx.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/Owning.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.
|
||||
* @param publicKey The public key for signing
|
||||
* @param secretKey The secret key for signing
|
||||
* @return The constructed transaction wrapper.
|
||||
*/
|
||||
protocol_autogen::Owning<STTx, AMMDeposit>
|
||||
build(PublicKey const& publicKey, SecretKey const& secretKey)
|
||||
{
|
||||
sign(publicKey, secretKey);
|
||||
return protocol_autogen::Owning<STTx, AMMDeposit>{STTx{std::move(object_)}};
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::transactions
|
||||
@@ -1,160 +0,0 @@
|
||||
// This file is auto-generated. Do not edit.
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STTx.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/Owning.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.
|
||||
* @param publicKey The public key for signing
|
||||
* @param secretKey The secret key for signing
|
||||
* @return The constructed transaction wrapper.
|
||||
*/
|
||||
protocol_autogen::Owning<STTx, AMMVote>
|
||||
build(PublicKey const& publicKey, SecretKey const& secretKey)
|
||||
{
|
||||
sign(publicKey, secretKey);
|
||||
return protocol_autogen::Owning<STTx, AMMVote>{STTx{std::move(object_)}};
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::transactions
|
||||
@@ -1,266 +0,0 @@
|
||||
// This file is auto-generated. Do not edit.
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STTx.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/Owning.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.
|
||||
* @param publicKey The public key for signing
|
||||
* @param secretKey The secret key for signing
|
||||
* @return The constructed transaction wrapper.
|
||||
*/
|
||||
protocol_autogen::Owning<STTx, AMMWithdraw>
|
||||
build(PublicKey const& publicKey, SecretKey const& secretKey)
|
||||
{
|
||||
sign(publicKey, secretKey);
|
||||
return protocol_autogen::Owning<STTx, AMMWithdraw>{STTx{std::move(object_)}};
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::transactions
|
||||
@@ -1,180 +0,0 @@
|
||||
// This file is auto-generated. Do not edit.
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STTx.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/Owning.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.
|
||||
* @param publicKey The public key for signing
|
||||
* @param secretKey The secret key for signing
|
||||
* @return The constructed transaction wrapper.
|
||||
*/
|
||||
protocol_autogen::Owning<STTx, AccountDelete>
|
||||
build(PublicKey const& publicKey, SecretKey const& secretKey)
|
||||
{
|
||||
sign(publicKey, secretKey);
|
||||
return protocol_autogen::Owning<STTx, AccountDelete>{STTx{std::move(object_)}};
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::transactions
|
||||
@@ -1,414 +0,0 @@
|
||||
// This file is auto-generated. Do not edit.
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STTx.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/Owning.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.
|
||||
* @param publicKey The public key for signing
|
||||
* @param secretKey The secret key for signing
|
||||
* @return The constructed transaction wrapper.
|
||||
*/
|
||||
protocol_autogen::Owning<STTx, AccountSet>
|
||||
build(PublicKey const& publicKey, SecretKey const& secretKey)
|
||||
{
|
||||
sign(publicKey, secretKey);
|
||||
return protocol_autogen::Owning<STTx, AccountSet>{STTx{std::move(object_)}};
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::transactions
|
||||
@@ -1,146 +0,0 @@
|
||||
// This file is auto-generated. Do not edit.
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STTx.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/Owning.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.
|
||||
* @param publicKey The public key for signing
|
||||
* @param secretKey The secret key for signing
|
||||
* @return The constructed transaction wrapper.
|
||||
*/
|
||||
protocol_autogen::Owning<STTx, Batch>
|
||||
build(PublicKey const& publicKey, SecretKey const& secretKey)
|
||||
{
|
||||
sign(publicKey, secretKey);
|
||||
return protocol_autogen::Owning<STTx, Batch>{STTx{std::move(object_)}};
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::transactions
|
||||
@@ -1,116 +0,0 @@
|
||||
// This file is auto-generated. Do not edit.
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STTx.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/Owning.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.
|
||||
* @param publicKey The public key for signing
|
||||
* @param secretKey The secret key for signing
|
||||
* @return The constructed transaction wrapper.
|
||||
*/
|
||||
protocol_autogen::Owning<STTx, CheckCancel>
|
||||
build(PublicKey const& publicKey, SecretKey const& secretKey)
|
||||
{
|
||||
sign(publicKey, secretKey);
|
||||
return protocol_autogen::Owning<STTx, CheckCancel>{STTx{std::move(object_)}};
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::transactions
|
||||
@@ -1,180 +0,0 @@
|
||||
// This file is auto-generated. Do not edit.
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STTx.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/Owning.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.
|
||||
* @param publicKey The public key for signing
|
||||
* @param secretKey The secret key for signing
|
||||
* @return The constructed transaction wrapper.
|
||||
*/
|
||||
protocol_autogen::Owning<STTx, CheckCash>
|
||||
build(PublicKey const& publicKey, SecretKey const& secretKey)
|
||||
{
|
||||
sign(publicKey, secretKey);
|
||||
return protocol_autogen::Owning<STTx, CheckCash>{STTx{std::move(object_)}};
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::transactions
|
||||
@@ -1,234 +0,0 @@
|
||||
// This file is auto-generated. Do not edit.
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STTx.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/Owning.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.
|
||||
* @param publicKey The public key for signing
|
||||
* @param secretKey The secret key for signing
|
||||
* @return The constructed transaction wrapper.
|
||||
*/
|
||||
protocol_autogen::Owning<STTx, CheckCreate>
|
||||
build(PublicKey const& publicKey, SecretKey const& secretKey)
|
||||
{
|
||||
sign(publicKey, secretKey);
|
||||
return protocol_autogen::Owning<STTx, CheckCreate>{STTx{std::move(object_)}};
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::transactions
|
||||
@@ -1,150 +0,0 @@
|
||||
// This file is auto-generated. Do not edit.
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STTx.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/Owning.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.
|
||||
* @param publicKey The public key for signing
|
||||
* @param secretKey The secret key for signing
|
||||
* @return The constructed transaction wrapper.
|
||||
*/
|
||||
protocol_autogen::Owning<STTx, Clawback>
|
||||
build(PublicKey const& publicKey, SecretKey const& secretKey)
|
||||
{
|
||||
sign(publicKey, secretKey);
|
||||
return protocol_autogen::Owning<STTx, Clawback>{STTx{std::move(object_)}};
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::transactions
|
||||
@@ -1,138 +0,0 @@
|
||||
// This file is auto-generated. Do not edit.
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STTx.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/Owning.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.
|
||||
* @param publicKey The public key for signing
|
||||
* @param secretKey The secret key for signing
|
||||
* @return The constructed transaction wrapper.
|
||||
*/
|
||||
protocol_autogen::Owning<STTx, CredentialAccept>
|
||||
build(PublicKey const& publicKey, SecretKey const& secretKey)
|
||||
{
|
||||
sign(publicKey, secretKey);
|
||||
return protocol_autogen::Owning<STTx, CredentialAccept>{STTx{std::move(object_)}};
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::transactions
|
||||
@@ -1,202 +0,0 @@
|
||||
// This file is auto-generated. Do not edit.
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STTx.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/Owning.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.
|
||||
* @param publicKey The public key for signing
|
||||
* @param secretKey The secret key for signing
|
||||
* @return The constructed transaction wrapper.
|
||||
*/
|
||||
protocol_autogen::Owning<STTx, CredentialCreate>
|
||||
build(PublicKey const& publicKey, SecretKey const& secretKey)
|
||||
{
|
||||
sign(publicKey, secretKey);
|
||||
return protocol_autogen::Owning<STTx, CredentialCreate>{STTx{std::move(object_)}};
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::transactions
|
||||
@@ -1,180 +0,0 @@
|
||||
// This file is auto-generated. Do not edit.
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STTx.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/Owning.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.
|
||||
* @param publicKey The public key for signing
|
||||
* @param secretKey The secret key for signing
|
||||
* @return The constructed transaction wrapper.
|
||||
*/
|
||||
protocol_autogen::Owning<STTx, CredentialDelete>
|
||||
build(PublicKey const& publicKey, SecretKey const& secretKey)
|
||||
{
|
||||
sign(publicKey, secretKey);
|
||||
return protocol_autogen::Owning<STTx, CredentialDelete>{STTx{std::move(object_)}};
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::transactions
|
||||
@@ -1,94 +0,0 @@
|
||||
// This file is auto-generated. Do not edit.
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STTx.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/Owning.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.
|
||||
* @param publicKey The public key for signing
|
||||
* @param secretKey The secret key for signing
|
||||
* @return The constructed transaction wrapper.
|
||||
*/
|
||||
protocol_autogen::Owning<STTx, DIDDelete>
|
||||
build(PublicKey const& publicKey, SecretKey const& secretKey)
|
||||
{
|
||||
sign(publicKey, secretKey);
|
||||
return protocol_autogen::Owning<STTx, DIDDelete>{STTx{std::move(object_)}};
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::transactions
|
||||
@@ -1,190 +0,0 @@
|
||||
// This file is auto-generated. Do not edit.
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STTx.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/Owning.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.
|
||||
* @param publicKey The public key for signing
|
||||
* @param secretKey The secret key for signing
|
||||
* @return The constructed transaction wrapper.
|
||||
*/
|
||||
protocol_autogen::Owning<STTx, DIDSet>
|
||||
build(PublicKey const& publicKey, SecretKey const& secretKey)
|
||||
{
|
||||
sign(publicKey, secretKey);
|
||||
return protocol_autogen::Owning<STTx, DIDSet>{STTx{std::move(object_)}};
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::transactions
|
||||
@@ -1,138 +0,0 @@
|
||||
// This file is auto-generated. Do not edit.
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STTx.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/Owning.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.
|
||||
* @param publicKey The public key for signing
|
||||
* @param secretKey The secret key for signing
|
||||
* @return The constructed transaction wrapper.
|
||||
*/
|
||||
protocol_autogen::Owning<STTx, DelegateSet>
|
||||
build(PublicKey const& publicKey, SecretKey const& secretKey)
|
||||
{
|
||||
sign(publicKey, secretKey);
|
||||
return protocol_autogen::Owning<STTx, DelegateSet>{STTx{std::move(object_)}};
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::transactions
|
||||
@@ -1,218 +0,0 @@
|
||||
// This file is auto-generated. Do not edit.
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STTx.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/Owning.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.
|
||||
* @param publicKey The public key for signing
|
||||
* @param secretKey The secret key for signing
|
||||
* @return The constructed transaction wrapper.
|
||||
*/
|
||||
protocol_autogen::Owning<STTx, DepositPreauth>
|
||||
build(PublicKey const& publicKey, SecretKey const& secretKey)
|
||||
{
|
||||
sign(publicKey, secretKey);
|
||||
return protocol_autogen::Owning<STTx, DepositPreauth>{STTx{std::move(object_)}};
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::transactions
|
||||
@@ -1,138 +0,0 @@
|
||||
// This file is auto-generated. Do not edit.
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/STTx.h>
|
||||
#include <xrpl/protocol/STParsedJSON.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
#include <xrpl/protocol_autogen/Owning.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.
|
||||
* @param publicKey The public key for signing
|
||||
* @param secretKey The secret key for signing
|
||||
* @return The constructed transaction wrapper.
|
||||
*/
|
||||
protocol_autogen::Owning<STTx, EnableAmendment>
|
||||
build(PublicKey const& publicKey, SecretKey const& secretKey)
|
||||
{
|
||||
sign(publicKey, secretKey);
|
||||
return protocol_autogen::Owning<STTx, EnableAmendment>{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