Compare commits

...

80 Commits

Author SHA1 Message Date
Denis Angell
68bd02b647 compose: alphanet from XRPLF/rippled@3.4.1 @ 00e64075 (14 branches)
Multibranch-Builder-Manifest: {"base":"XRPLF/rippled@3.4.1","base_sha":"00e640751460c137636fdb6dae6b4280de355d81","branches":[{"repo":"Transia-RnD/rippled","branch":"dangell7/amm-curves","sha":"2a11a0f342f207638e6aef2ff070bd935401f39f","outcome":"ai-resolved","rebase":true},{"repo":"Transia-RnD/rippled","branch":"dangell7/mpt-structured-data","sha":"3e7af2ab7e05e0b4258627508659af4c073fe824","outcome":"merged","rebase":true},{"repo":"Transia-RnD/rippled","branch":"dilithium-full","sha":"877aeb0f91ce7c8d43c45c00097c2654280797a1","outcome":"ai-resolved","rebase":true},{"repo":"Transia-RnD/rippled","branch":"dangell7/confidential-voting","sha":"adaae9496ac89c9c015d047bade5b38833ad87bc","outcome":"ai-resolved","rebase":true},{"repo":"Transia-RnD/rippled","branch":"token-paychan","sha":"ba093095b80a86ed5f6fc6c8184a8a55fed2e941","outcome":"merged","rebase":true},{"repo":"Transia-RnD/rippled","branch":"dangell7/offer-qualifiers","sha":"6ad5aae76100ae9e8274a8a84ddca38933f21233","outcome":"ai-resolved","rebase":true},{"repo":"Transia-RnD/rippled","branch":"dangell7/vault-accrual","sha":"bb60431ebf6ef5d41ef588d8475dbb52f95744b5","outcome":"ai-resolved","rebase":true},{"repo":"Transia-RnD/rippled","branch":"feature-p256","sha":"b30e9fc369a431ce766b7ae8158479cf236033d5","outcome":"ai-resolved","rebase":true},{"repo":"Transia-RnD/rippled","branch":"dangell7/firewall","sha":"008643d01cf50c20b2afd324f28dfd9dc771a55e","outcome":"ai-resolved","rebase":true},{"repo":"Transia-RnD/rippled","branch":"dangell7/repo-market","sha":"6badf9b5aa3330bf6c8b8c33b47d161df72f7540","outcome":"ai-resolved","rebase":true},{"repo":"Transia-RnD/rippled","branch":"dangell7/beneficiary","sha":"e34711194ce3486a54d1f17b2071aed319b1de8f","outcome":"ai-resolved","rebase":true},{"repo":"Transia-RnD/rippled","branch":"dangell7/coupon-payments","sha":"d9ed088c6beee730cf8c7dac74cf5a0a57a58800","outcome":"ai-resolved","rebase":true},{"repo":"Transia-RnD/rippled","branch":"dangell7/subscriptions","sha":"f3e2670dfa26263526bdac00386f7c78c36a302a","outcome":"ai-resolved","rebase":true},{"repo":"Transia-RnD/rippled","branch":"dangell7/token-issuance","sha":"b045b862223d3a6735161bf0fffa23cffa12b2ed","outcome":"ai-resolved","rebase":true}],"composed_sha":"8e6b11913fb390b793a3889b788f09d1cc7e80b0","kind":"xrpld","tree_dir":"rippled","target":"XRPLF/rippled@alphanet","options":{"force_supported":"ON"},"prepared":{}}
2026-10-16 00:19:37 -04:00
multibranch-builder
8e6b11913f Merge remote-tracking branch 'Transia-RnD-rippled/dangell7/token-issuance' into HEAD
# Conflicts:
#	include/xrpl/protocol/LedgerFormats.h
#	include/xrpl/protocol/TER.h
#	include/xrpl/protocol/detail/ledger_entries.macro
#	include/xrpl/tx/invariants/InvariantCheck.h
#	src/libxrpl/protocol/Indexes.cpp
#	src/libxrpl/protocol/TER.cpp
#	src/libxrpl/tx/paths/BookStep.cpp
#	src/libxrpl/tx/transactors/token/MPTokenIssuanceDestroy.cpp
2026-10-15 23:20:22 -04:00
multibranch-builder
78d502d849 Merge remote-tracking branch 'Transia-RnD-rippled/dangell7/subscriptions' into HEAD
# Conflicts:
#	include/xrpl/protocol/Indexes.h
#	include/xrpl/protocol/LedgerFormats.h
#	include/xrpl/protocol/TxFlags.h
#	include/xrpl/protocol/jss.h
#	include/xrpl/tx/invariants/InvariantCheck.h
#	src/libxrpl/protocol/Indexes.cpp
2026-10-15 23:15:19 -04:00
multibranch-builder
511adaa821 Merge remote-tracking branch 'Transia-RnD-rippled/dangell7/coupon-payments' into HEAD
# Conflicts:
#	include/xrpl/protocol/detail/ledger_entries.macro
#	include/xrpl/protocol/jss.h
#	include/xrpl/protocol_autogen/ledger_entries/MPToken.h
#	include/xrpl/tx/invariants/InvariantCheck.h
#	src/libxrpl/protocol/Indexes.cpp
#	src/tests/libxrpl/protocol_autogen/ledger_entries/MPTokenTests.cpp
2026-10-15 23:10:59 -04:00
multibranch-builder
f2d45488a3 Merge remote-tracking branch 'Transia-RnD-rippled/dangell7/beneficiary' into HEAD
# Conflicts:
#	include/xrpl/tx/invariants/InvariantCheck.h
#	src/libxrpl/protocol/Indexes.cpp
#	src/libxrpl/tx/Transactor.cpp
2026-10-15 23:07:34 -04:00
multibranch-builder
bb45841aa5 Merge remote-tracking branch 'Transia-RnD-rippled/dangell7/repo-market' into HEAD
# Conflicts:
#	include/xrpl/protocol/Indexes.h
#	include/xrpl/protocol/TER.h
#	src/libxrpl/protocol/Indexes.cpp
#	src/libxrpl/protocol/TER.cpp
#	src/xrpld/rpc/handlers/ledger/LedgerEntry.cpp
2026-10-15 23:05:33 -04:00
multibranch-builder
2fed6c6e19 Merge remote-tracking branch 'Transia-RnD-rippled/dangell7/firewall' into HEAD
# Conflicts:
#	include/xrpl/protocol/detail/transactions.macro
#	src/libxrpl/protocol/Indexes.cpp
2026-10-15 23:03:12 -04:00
multibranch-builder
8eacaa3968 Merge remote-tracking branch 'Transia-RnD-rippled/feature-p256' into HEAD
# Conflicts:
#	include/xrpl/protocol/Indexes.h
#	include/xrpl/protocol/KeyType.h
#	include/xrpl/protocol/PublicKey.h
#	src/libxrpl/protocol/Indexes.cpp
#	src/libxrpl/protocol/PublicKey.cpp
#	src/libxrpl/protocol/SecretKey.cpp
#	src/xrpld/rpc/detail/RPCCall.cpp
2026-10-15 22:59:33 -04:00
multibranch-builder
e4502134cf Merge remote-tracking branch 'Transia-RnD-rippled/dangell7/vault-accrual' into HEAD
# Conflicts:
#	include/xrpl/protocol/detail/ledger_entries.macro
2026-10-15 22:55:46 -04:00
multibranch-builder
ed9d7f7282 Merge remote-tracking branch 'Transia-RnD-rippled/dangell7/offer-qualifiers' into HEAD
# Conflicts:
#	include/xrpl/protocol/TER.h
#	include/xrpl/protocol/jss.h
#	src/libxrpl/protocol/TER.cpp
2026-10-15 22:53:35 -04:00
multibranch-builder
59184352e9 Merge remote-tracking branch 'Transia-RnD-rippled/token-paychan' into HEAD 2026-10-15 22:51:53 -04:00
multibranch-builder
e288294b0d Merge remote-tracking branch 'Transia-RnD-rippled/dangell7/confidential-voting' into HEAD
# Conflicts:
#	include/xrpl/protocol/Indexes.h
#	include/xrpl/protocol/TER.h
#	include/xrpl/protocol/detail/ledger_entries.macro
#	include/xrpl/protocol/jss.h
#	src/libxrpl/protocol/Indexes.cpp
#	src/libxrpl/protocol/TER.cpp
2026-10-15 22:51:49 -04:00
multibranch-builder
ad99db8a34 Merge remote-tracking branch 'Transia-RnD-rippled/dilithium-full' into HEAD
# Conflicts:
#	src/xrpld/rpc/detail/RPCCall.cpp
2026-10-15 22:46:09 -04:00
multibranch-builder
044034b1b9 Merge remote-tracking branch 'Transia-RnD-rippled/dangell7/mpt-structured-data' into HEAD 2026-10-15 22:45:23 -04:00
multibranch-builder
9718f4a54c Merge remote-tracking branch 'Transia-RnD-rippled/dangell7/amm-curves' into HEAD
# Conflicts:
#	.github/workflows/reusable-package.yml
2026-10-15 22:45:21 -04:00
Ayaz Salikhov
00e6407514 chore: Bump version to 3.4.1 and make pkg_release 2 2026-10-09 23:50:58 +01:00
Denis Angell
19c94c73f4 fix: Reject Batch inner txs with the wrong wrapper (fixBatchV1_2) 2026-10-09 16:04:36 +01:00
Bart
cd005ff60d ci: Update Nexus packaging URL 2026-10-09 16:04:36 +01:00
Gregory Tsipenyuk
578224f2e6 fix: Assorted integer-arithmetic hardening in the payment engine and ledger helpers 2026-10-09 16:04:35 +01:00
Denis Angell
877aeb0f91 fix: Drop the no-op Dilithium size assert from PublicKey.cpp 2026-10-08 03:42:00 +00:00
Denis Angell
401fbc120e fix: Use a nonzero base58 digit in the length_ceiling test 2026-10-08 03:15:04 +00:00
Denis Angell
5dfedfa8db fix: Configure the dilithium validator key type in the Subscribe validations test 2026-10-08 03:11:21 +00:00
Denis Angell
083ea016d7 fix: Regenerate the dilithium secret key base58 vectors in Seed_test 2026-10-08 03:11:21 +00:00
Denis Angell
360ef1e1e0 style: clang-format and include style for the Quantum files 2026-10-08 03:05:20 +00:00
Denis Angell
d9ed088c6b fix: reject a zero EarliestCallTime in CouponScheduleCreate 2026-10-08 00:43:11 +00:00
Denis Angell
ba093095b8 feat: accept token amounts in channel_authorize and channel_verify 2026-10-07 23:06:03 +00:00
Denis Angell
71eb4e4233 fix: serialize token claim authorizations as the Amount field value 2026-10-07 23:05:10 +00:00
Denis Angell
3eebaa0c87 fix: Use a dilithium ephemeral key for the BadMasterKey manifest case 2026-10-07 21:42:10 +00:00
Denis Angell
d828083f2f fix: Regenerate the dilithium secret key vectors in the FIPS 204 layout 2026-10-07 21:42:10 +00:00
Denis Angell
5858ba1f8c fix: Size kMaxManifestBytes for dilithium manifests 2026-10-07 21:42:10 +00:00
Denis Angell
739653a742 fix: Port the Quantum test suites to develop's current APIs 2026-10-07 21:24:32 +00:00
Denis Angell
196e322dda fix: Use the declared manifest names in Manifest_test apply 2026-10-07 21:08:05 +00:00
Denis Angell
ab422da5c0 refactor: Name the Dilithium secret key size as SecretKey::kDilithiumSize 2026-10-07 21:07:11 +00:00
Denis Angell
a12f15ed0b build: Drop the no-op randombytes strip and undefined PREFIX from the Dilithium build 2026-10-07 21:06:39 +00:00
Denis Angell
e15aa2f9f0 style: clang-format and include style for the Dilithium key files 2026-10-07 21:05:43 +00:00
Denis Angell
360800dedd fix: Erase Dilithium key material and remove dead code in SecretKey.cpp 2026-10-02 13:06:17 +00:00
Denis Angell
4e79a96019 fix: Guard PublicKey buffer bound and fix Dilithium dispatch branch 2026-10-02 13:04:39 +00:00
Denis Angell
fe21db6b0f fix: Stop aborting on Dilithium key_type in channel_authorize 2026-10-02 13:04:16 +00:00
Denis Angell
2ef482a22e fix: Harden Dilithium external project build and key-size invariants 2026-10-02 13:03:48 +00:00
Denis Angell
ed9383392b fix: adapt token paychan to develop's TxSettings and SeqProxy APIs 2026-09-17 11:40:53 +00:00
Denis Angell
09714443c0 Local merge develop into token-paychan 2026-09-17 11:40:40 +00:00
Denis Angell
bb60431ebf featureVaultContinuousAccrual 2026-09-12 06:41:06 -04:00
Denis Angell
2a11a0f342 featureAMMCurves 2026-09-12 06:35:48 -04:00
Denis Angell
b045b86222 featureTokenIssuance 2026-09-12 06:35:47 -04:00
Denis Angell
f3e2670dfa featureSubscription 2026-09-12 06:35:47 -04:00
Denis Angell
6badf9b5aa featureRepo 2026-09-12 06:35:47 -04:00
Denis Angell
008643d01c featureFirewall 2026-09-12 06:35:47 -04:00
Denis Angell
adaae9496a featureConfidentialVoting 2026-09-12 06:35:47 -04:00
Denis Angell
e34711194c featureBeneficiary 2026-09-12 06:35:46 -04:00
Denis Angell
e634c6ddc7 featureQuantum 2026-09-12 06:01:04 -04:00
Denis Angell
b30e9fc369 featurePasskey 2026-09-12 05:51:14 -04:00
Denis Angell
6ad5aae761 featureOfferQualifiers 2026-09-12 05:36:26 -04:00
Denis Angell
5af42fc475 featureCouponPayments 2026-09-11 23:27:17 -04:00
Denis Angell
3e7af2ab7e featureMPTStructuredData 2026-09-11 22:58:58 -04:00
Sergey Kuznetsov
9403736199 ci: Exclude Rust unit tests from code coverage (#8203) 2026-09-10 11:38:25 +00:00
Mayukha Vadari
028783661d feat: Apply .macro changes from ripple/smart-escrow (#8157)
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-09-09 20:05:58 +00:00
Vito Tumas
21890d9daf feat: Register featureLendingProtocolV1_2 amendment (#8185)
Co-authored-by: Bart <bthomee@users.noreply.github.com>
2026-09-09 10:01:32 +00:00
Sergey Kuznetsov
060957ed39 ci: Add nightly Rust toolchain to the CI image (#8182)
Co-authored-by: Bart <bthomee@users.noreply.github.com>
2026-09-09 01:24:28 +00:00
Ayaz Salikhov
1381483c7a build: Fix test installation on debian:11 due to EOL (#8200) 2026-09-08 22:49:16 +00:00
dependabot[bot]
3e4bdf2782 ci: [DEPENDABOT] bump actions/deploy-pages from 5.0.0 to 5.0.1 in the github-actions group across 1 directory (#8180)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-09-07 16:07:56 +00:00
Mayukha Vadari
e3c8996e44 feat: Add fixCleanup3_5_0 amendment placeholder (#8174) 2026-09-05 00:06:14 +00:00
yinyiqian1
d5bfe94f15 feat: Support key rotation in MPTokenIssuanceSet (#7915) 2026-09-03 21:13:06 +00:00
dangell8
c8c4fe9caf Merge branch 'develop' into token-paychan 2026-08-06 16:29:31 +00:00
dangell8
0d360faab0 Merge branch 'develop' into token-paychan 2026-08-06 02:34:01 +00:00
dangell8
619867f7a9 Merge branch 'develop' into token-paychan
Includes post-merge compile fixes (build-verified).
2026-08-05 13:57:57 +00:00
dangell8
f450f5de4e Merge branch 'develop' into token-paychan 2026-08-04 08:52:52 +00:00
dangell8
bce0b8afa6 fix: Fix build issues (pre-merge)
Applied by Sentinel /doctor
2026-08-04 08:52:12 +00:00
Denis Angell
96d17649f7 feat: add PaymentChannelClawback for issuer clawback of channeled tokens 2026-08-03 00:14:55 -04:00
Denis Angell
3c85a0180f refactor: address review nits 2026-08-02 16:05:25 -04:00
Denis Angell
096fa967da fix: repair bad develop merge resolutions 2026-08-02 16:05:22 -04:00
dangell8
1ced7dc8f3 Merge branch 'develop' into token-paychan
Includes post-merge compile fixes (build-verified).
2026-07-17 15:02:03 +00:00
Denis Angell
df1458a136 test: expand token paychan transactor phase coverage 2026-07-13 19:25:43 -04:00
Denis Angell
cdd5ebf4c1 fix: validate paychan asset match in preclaim with tecWRONG_ASSET 2026-07-13 16:33:49 -04:00
Denis Angell
1a9a11fc31 style: remove includes flagged by misc-include-cleaner 2026-07-13 15:28:42 -04:00
Denis Angell
a9430d4778 style: conform doxygen comments to check-doxygen-style hook 2026-07-13 15:11:48 -04:00
Denis Angell
fed5093488 fix: adapt token paychan to develop merge helpers and sponsor reserve 2026-07-13 14:59:54 -04:00
Denis Angell
6c74fc1a7d Merge branch 'develop' into token-paychan 2026-07-13 14:05:56 -04:00
dangell8
939f8b1a49 Merge develop into token-paychan 2026-07-11 04:27:08 +00:00
Denis Angell
1f8c462c42 feat: XLS-93d Token-Enabled Payment Channels 2026-07-10 12:14:12 -04:00
Denis Angell
47df026dcc refactor: Move escrow lock/unlock helpers to EscrowHelpers.h 2026-07-10 11:55:13 -04:00
475 changed files with 105056 additions and 1565 deletions

View File

@@ -43,6 +43,7 @@ suggestWords:
- synched->synced
- synch->sync
words:
- cusip
- abempty
- AMMID
- AMMMPT
@@ -67,9 +68,10 @@ words:
- Britto
- Btrfs
- Buildx
- canonicality
- canonicalised
- canonicality
- cctools
- CGNAT
- changespq
- checkme
- choco
@@ -178,11 +180,11 @@ words:
- mathbunnyru
- mcmodel
- MEMORYSTATUSEX
- MPTAMM
- MPTDEX
- Merkle
- misprediction
- mispricing
- missingok
- MPTAMM
- mptbalance
- MPTDEX
- mptflags
@@ -257,8 +259,8 @@ words:
- replayer
- repodata
- repomd
- rerandomize
- rerandomization
- rerandomize
- rerandomized
- rerandomizes
- rerere
@@ -281,8 +283,8 @@ words:
- rustup
- sahyadri
- Satoshi
- scons
- Schnorr
- scons
- secp
- sendq
- seqit
@@ -334,8 +336,8 @@ words:
- txn
- txns
- txs
- ubsan
- UBSAN
- ubsan
- ufdio
- umant
- unacquired
@@ -347,7 +349,9 @@ words:
- unfindable
- unflatten
- unfund
- ungated
- unimpair
- unmetered
- unroutable
- unscalable
- unserviced
@@ -386,5 +390,3 @@ words:
- xxhash
- xxhasher
- zstdio
- CGNAT
- ungated

View File

@@ -1,5 +1,5 @@
{
"image_tag": "sha-473fe44",
"image_tag": "sha-060957e",
"configs": {
"ubuntu": [
{

View File

@@ -5,15 +5,13 @@ on:
branches:
- develop
paths:
- ".github/workflows/build-nix-images.yml"
- "flake.nix"
- "flake.lock"
- "rust-toolchain.toml"
- "nix/**"
- "!nix/docker/README.md"
- "!nix/devshell.nix"
- "!nix/check-tools/*.txt"
- "bin/check-tools.sh"
- "!nix/check-tools/**"
- "bin/default-loader-path.sh"
- "bin/install-sanitizer-libs.sh"
pull_request:
@@ -25,7 +23,7 @@ on:
- "nix/**"
- "!nix/docker/README.md"
- "!nix/devshell.nix"
- "!nix/check-tools/*.txt"
- "!nix/check-tools/**"
- "bin/check-tools.sh"
- "bin/default-loader-path.sh"
- "bin/install-sanitizer-libs.sh"

View File

@@ -34,7 +34,7 @@ permissions:
jobs:
audit:
runs-on: ubuntu-latest
container: ghcr.io/xrplf/xrpld/nix-ubuntu:sha-473fe44
container: ghcr.io/xrplf/xrpld/nix-ubuntu:sha-060957e
permissions:
contents: read
# Needed to open an issue on scheduled failures.

View File

@@ -41,7 +41,7 @@ env:
jobs:
build:
runs-on: ubuntu-latest
container: ghcr.io/xrplf/xrpld/nix-ubuntu:sha-473fe44
container: ghcr.io/xrplf/xrpld/nix-ubuntu:sha-060957e
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
@@ -91,4 +91,4 @@ jobs:
steps:
- name: Deploy to GitHub Pages
id: deploy
uses: actions/deploy-pages@cd2ce8fcbc39b97be8ca5fce6e763baed58fa128 # v5.0.0
uses: actions/deploy-pages@368f82528645a54fb793d4d04e342629a3f51346 # v5.0.1

View File

@@ -34,7 +34,7 @@ jobs:
needs: [determine-files]
if: ${{ needs.determine-files.outputs.cpp_changed_files != '' || needs.determine-files.outputs.need_full_run == 'true' }}
runs-on: ["self-hosted", "Linux", "X64", "heavy"]
container: "ghcr.io/xrplf/xrpld/nix-debian:sha-473fe44"
container: "ghcr.io/xrplf/xrpld/nix-debian:sha-060957e"
permissions:
contents: read
issues: write

View File

@@ -25,7 +25,7 @@ on:
description: "The base URL of the Nexus instance hosting the deb and rpm repositories."
required: false
type: string
default: https://packages.xrplf.org
default: https://packages-upload.xrplf.org
secrets:
remote_username:
@@ -112,7 +112,7 @@ jobs:
env:
PACKAGE_TYPE: ${{ matrix.package_type }}
PACKAGE_VARIANT: ${{ matrix.package_variant }}
PKG_RELEASE: ${{ steps.release_info.outputs.pkg_release }}
PKG_RELEASE: ${{ startsWith(github.ref, 'refs/tags/') && '2' || steps.release_info.outputs.pkg_release }}
CHANNEL: ${{ steps.release_info.outputs.channel }}
run: |
./package/build_pkg.py \

View File

@@ -1,8 +1,9 @@
# Clippy, coverage and documentation for the Rust crates in crates/. Each runs
# as an independent job on a GitHub-hosted runner, but inside the same container
# image used to build the crates in the C++/Corrosion path, so the toolchain
# (and therefore the lints, coverage instrumentation and the cargo cache) matches
# what production builds use.
# (and therefore the lints and the cargo cache) matches what production builds
# use. Coverage is the exception: it needs the nightly rustc that honours
# #[coverage(off)], which the image carries alongside the pinned stable.
#
# Rust unit tests are deliberately NOT run here. They run as part of the C++
# build (reusable-build-test-config.yml), which already compiles the crates on a
@@ -27,7 +28,7 @@ permissions:
jobs:
clippy:
runs-on: ubuntu-latest
container: ghcr.io/xrplf/xrpld/nix-ubuntu:sha-473fe44
container: ghcr.io/xrplf/xrpld/nix-ubuntu:sha-060957e
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
@@ -40,11 +41,14 @@ jobs:
coverage:
runs-on: ubuntu-latest
container: ghcr.io/xrplf/xrpld/nix-ubuntu:sha-473fe44
container: ghcr.io/xrplf/xrpld/nix-ubuntu:sha-060957e
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Use the nightly Rust toolchain
run: rust-nightly path >>"${GITHUB_PATH}"
- name: Use cargo artifacts cache
uses: ./.github/actions/cargo-cache
@@ -66,7 +70,7 @@ jobs:
doc:
runs-on: ubuntu-latest
container: ghcr.io/xrplf/xrpld/nix-ubuntu:sha-473fe44
container: ghcr.io/xrplf/xrpld/nix-ubuntu:sha-060957e
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1

View File

@@ -40,7 +40,7 @@ defaults:
jobs:
upload:
runs-on: ubuntu-latest
container: ghcr.io/xrplf/xrpld/nix-ubuntu:sha-473fe44
container: ghcr.io/xrplf/xrpld/nix-ubuntu:sha-060957e
env:
REMOTE_NAME: ${{ inputs.remote_name }}
CONAN_LOGIN_USERNAME_XRPLF: ${{ secrets.remote_username }}

View File

@@ -70,6 +70,11 @@ repos:
language: system
types: [rust]
pass_filenames: false # rustfmt formats the whole workspace
- id: check-coverage-attrs
name: check Rust coverage attributes
entry: ./bin/pre-commit/check_rust_coverage_attrs.py
language: python
files: ^crates/.*\.rs$
- repo: https://github.com/BlankSpruce/gersemi-pre-commit
rev: e98930bdc210d3387007f9252d8c1694ea7e410f # frozen: 0.27.7

View File

@@ -28,6 +28,10 @@ Version 3.4.0 is not yet released. These changes are available in the 3.4.0 beta
### Additions in 3.4.0
- `book_offers`, `account_offers`: With the `OfferQualifiers` amendment, an offer entry may now include `all_or_none: true` (the offer carries the `lsfAllOrNone` flag) and/or `min_quantity` (the offer's `MinQuantity` amount). These mark execution-qualified ("contingent") offers that cannot be taken to arbitrary depth; clients should exclude them from quoted/takeable depth. The `OfferCreate` transaction gains the `tfAllOrNone` and `tfPostOnly` flags and an optional `MinQuantity` field, and a marketable `tfPostOnly` offer is rejected with the new `tecWOULD_CROSS` result.
- `account_tx`: Added an optional `delegate` request object to filter delegated transactions. The object requires `delegate_filter`, which must be either `actor` for transactions owned by the requested account but signed by another account, or `authorizer` for transactions signed by the requested account on behalf of another account. The optional `counter_party` account narrows the results to a specific signer/delegate for `actor` or a specific owner/delegator for `authorizer`. Malformed `delegate`, `delegate_filter`, and `counter_party` values return standard invalid field errors, and invalid account IDs return `actMalformed`.
When paginating delegate-filtered queries, a marker from a delegate-filtered query includes a `delegate` flag and is only valid for follow-up requests that also supply `delegate` (mixing marker conventions returns `invalidParams`). Because filtering is applied after the ledger scan, a page may contain fewer results than `limit` (possibly zero) while still returning a marker, so callers must continue until no marker is present.
- `ledger`: `nftoken_id`, `nftoken_ids`, and `offer_id` are now included in transaction metadata when transactions are expanded (`expand`, or admin-only `full`), matching the `tx`, `account_tx`, and `subscribe` (`transactions` stream) responses. ([#5706](https://github.com/XRPLF/rippled/pull/5706))
### Bugfixes in 3.4.0
@@ -62,6 +66,11 @@ This release contains bug fixes only and no API changes.
### Additions in 3.2.0
- `ledger_entry`, `account_objects`: Added the `Ballot` and `BallotVote` ledger entry types introduced by the `ConfidentialVoting` amendment. `ledger_entry` accepts a `ballot` request object (`owner` + `seq`) and a `ballot_vote` request object (`ballot_id` + `account`), or a hex object ID for either. `account_objects` returns these entries and accepts them as `type` filters.
- `account_tx`: Added an optional `delegate` request object to filter delegated transactions. The object requires `delegate_filter`, which must be either `actor` for transactions owned by the requested account but signed by another account, or `authorizer` for transactions signed by the requested account on behalf of another account. The optional `counter_party` account narrows the results to a specific signer/delegate for `actor` or a specific owner/delegator for `authorizer`. Malformed `delegate`, `delegate_filter`, and `counter_party` values return standard invalid field errors, and invalid account IDs return `actMalformed`.
When paginating delegate-filtered queries, a marker from a delegate-filtered query includes a `delegate` flag and is only valid for follow-up requests that also supply `delegate` (mixing marker conventions returns `invalidParams`). Because filtering is applied after the ledger scan, a page may contain fewer results than `limit` (possibly zero) while still returning a marker, so callers must continue until no marker is present.
- `ledger_entry`, `account_objects`: The `Delegate` ledger entry now includes an optional `DestinationNode` field, which stores the index into the authorized account's owner directory. This field is present on entries created after bidirectional directory tracking was introduced and may appear in RPC responses for those entries. ([#6681](https://github.com/XRPLF/rippled/pull/6681))
- `server_definitions`: Added the following new sections to the response ([#6321](https://github.com/XRPLF/rippled/pull/6321)):
- `TRANSACTION_FORMATS`: Describes the fields and their optionality for each transaction type, including common fields shared across all transactions.

View File

@@ -99,6 +99,7 @@ if(only_docs)
return()
endif()
include(deps/dilithium)
include(deps/Boost)
add_subdirectory(external/antithesis-sdk)

View File

@@ -158,6 +158,7 @@ if [ "${os}" = "linux" ] || [ "${os}" = "macos" ]; then
check cargo-nextest cargo nextest --version
check clippy-driver
check rust-analyzer
check rust-nightly rust-nightly run rustc --version
check rustc
check rustfmt
fi

View File

@@ -0,0 +1,149 @@
#!/usr/bin/env python3
"""
Check that Rust unit tests stay out of the coverage report.
cargo-llvm-cov instruments the test code along with everything else, so a test
module that is not excluded counts its own body as covered and inflates the
reported number. Excluding it takes two attributes:
* every `#[cfg(test)]` module carries
`#[cfg_attr(coverage_nightly, coverage(off))]`;
* every crate root (lib.rs, main.rs) carries
`#![cfg_attr(coverage_nightly, feature(coverage_attribute))]`, which the
attribute above needs in order to compile.
Both are inert outside the coverage job: cargo-llvm-cov defines
`coverage_nightly` only when it runs on a nightly toolchain.
The crate-root gate is checked even in a crate that has no tests yet, because
that is what lets the first test module added later carry the attribute without
a build failure. Missing it is a hard error, so it cannot go unnoticed; a
missing `coverage(off)` fails open, which is why this check exists.
Matching is on exact attribute text, which works because `cargo fmt` runs over
the whole workspace in the hook ahead of this one: rustfmt puts every attribute
on its own line and normalizes what is inside it, turning `#[cfg( test )]`
and `#[cfg(test,)]` alike into `#[cfg(test)]`. So there is nothing here that
parses Rust. The price is that a cfg this file does not spell out literally --
`all(test, ...)`, `any(test, ...)`, `not(test)` -- is reported rather than
classified, on the grounds that guessing at coverage semantics is how a check
like this ends up quietly wrong.
Usage: ./bin/pre-commit/check_rust_coverage_attrs.py <file1> <file2> ...
Exit status is non-zero if any violation is found.
"""
import re
import sys
from dataclasses import dataclass
from pathlib import Path
CRATE_ROOTS = {"lib.rs", "main.rs"}
FEATURE_ATTR = "#![cfg_attr(coverage_nightly, feature(coverage_attribute))]"
COVERAGE_OFF_ATTR = "#[cfg_attr(coverage_nightly, coverage(off))]"
CFG_TEST_ATTR = "#[cfg(test)]"
# Any other cfg that mentions `test`. String literals are blanked before this
# runs, so `feature = "test"` does not read as the `test` cfg.
RE_CFG_MENTIONS_TEST = re.compile(r"^#\[cfg\(.*\btest\b.*\)\]$")
RE_STRING = re.compile(r'"(?:[^"\\]|\\.)*"')
RE_MOD = re.compile(r"^(?:pub(?:\([^)]*\))?\s+)?mod\s+([A-Za-z_]\w*)")
@dataclass(frozen=True)
class Finding:
line: int
label: str
message: str
def _check_module(attrs: list[str], line: int, name: str) -> list[Finding]:
"""Findings for one module, given the attributes attached to it."""
if COVERAGE_OFF_ATTR in attrs:
return [] # excluded from coverage; which cfg gates it does not matter
if CFG_TEST_ATTR in attrs:
return [
Finding(
line,
"missing-coverage-off",
f"`mod {name}` is #[cfg(test)] but not excluded from coverage; "
f"add {COVERAGE_OFF_ATTR}",
)
]
unclassified = [
attr for attr in attrs if RE_CFG_MENTIONS_TEST.match(RE_STRING.sub('""', attr))
]
if unclassified:
return [
Finding(
line,
"unclassified-cfg",
f"`mod {name}` is gated on {unclassified[0]}, which this check "
f"cannot tell apart from a module that ships in the library; "
f"add {COVERAGE_OFF_ATTR} if it is test-only, or teach this "
f"check the cfg if it is not",
)
]
return []
def _check_test_modules(lines: list[str]) -> list[Finding]:
"""Findings for every test module that is not excluded from coverage."""
findings: list[Finding] = []
attrs: list[str] = []
attrs_line = 0
for number, raw in enumerate(lines, start=1):
stripped = raw.strip()
# Blank lines and comments are allowed between an attribute and its item.
if not stripped or stripped.startswith("//"):
continue
if stripped.startswith("#["):
if not attrs:
attrs_line = number
attrs.append(stripped)
continue
module = RE_MOD.match(stripped)
if module is not None and attrs:
findings += _check_module(attrs, attrs_line, module.group(1))
attrs = []
return findings
def _check_crate_root(name: str, lines: list[str]) -> list[Finding]:
"""A finding if a crate root is missing the coverage_attribute feature gate."""
if name not in CRATE_ROOTS:
return []
if any(line.strip() == FEATURE_ATTR for line in lines):
return []
return [
Finding(
1,
"missing-feature-gate",
f"crate root is missing {FEATURE_ATTR}",
)
]
def check_source(name: str, text: str) -> list[Finding]:
"""Findings for one file's contents; `name` is its base name (lib.rs, ...)."""
lines = text.splitlines()
return _check_crate_root(name, lines) + _check_test_modules(lines)
def check_file(path: Path) -> list[Finding]:
return check_source(path.name, path.read_text(encoding="utf-8"))
def main() -> int:
total = 0
for path in (Path(name) for name in sys.argv[1:]):
for finding in check_file(path):
total += 1
print(f"{path}:{finding.line}: {finding.label}: {finding.message}")
return 1 if total else 0
if __name__ == "__main__":
sys.exit(main())

View File

@@ -69,6 +69,7 @@ target_link_libraries(
Xrpl::opts
Xrpl::syslibs
secp256k1::secp256k1
NIH::dilithium2_ref
xrpl.libpb
xxHash::xxhash
$<$<BOOL:${voidstar}>:antithesis-sdk-cpp>

View File

@@ -0,0 +1,75 @@
include(ExternalProject)
ExternalProject_Add(
dilithium_src
# Pin to an explicit commit, not a moving branch ref. Bumping this SHA
# is a supply-chain decision that must be reviewed; never revert to a
# branch tag here. 3032292 is pq-crystals/dilithium@444cdcc84eb36b66fe27b3a2529ee48f6d8150c2
# plus one commit that touches only ref/Makefile, adding the
# libdilithium2_ref.a and libfips202_ref.a targets; every other file
# under ref/ is byte-identical to upstream.
# https://github.com/Transia-RnD/dilithium/commit/3032292cfd4d94e0df9bd49a0098669ca9166aa1
GIT_REPOSITORY https://github.com/Transia-RnD/dilithium.git
GIT_TAG 3032292cfd4d94e0df9bd49a0098669ca9166aa1
GIT_SHALLOW FALSE
CONFIGURE_COMMAND ""
LOG_BUILD ON
BUILD_IN_SOURCE 0
# No shell: the flags reach make through the environment. -fstack-protector
# and -fPIC are what XrplCompiler.cmake gives every other translation unit.
BUILD_COMMAND
COMMAND ${CMAKE_COMMAND} -E copy_directory <SOURCE_DIR>/ref <BINARY_DIR>/ref
COMMAND make -C <BINARY_DIR>/ref clean
COMMAND ${CMAKE_COMMAND} -E env "CFLAGS=${CMAKE_C_FLAGS} -fstack-protector -fPIC -DDILITHIUM_MODE=2 -DDILITHIUM_RANDOMIZED_SIGNING" make -C <BINARY_DIR>/ref libdilithium2_ref.a libfips202_ref.a
INSTALL_COMMAND ""
BUILD_BYPRODUCTS
<BINARY_DIR>/ref/libdilithium2_ref.a
<BINARY_DIR>/ref/libfips202_ref.a
)
ExternalProject_Get_Property(dilithium_src SOURCE_DIR BINARY_DIR)
set(dilithium_src_SOURCE_DIR "${SOURCE_DIR}")
set(dilithium_src_BINARY_DIR "${BINARY_DIR}")
# Include the reference implementation headers from source
include_directories("${dilithium_src_SOURCE_DIR}/ref")
# Create imported targets for each static library using BINARY_DIR
add_library(dilithium::dilithium2_ref STATIC IMPORTED GLOBAL)
set_target_properties(dilithium::dilithium2_ref PROPERTIES
IMPORTED_LOCATION "${dilithium_src_BINARY_DIR}/ref/libdilithium2_ref.a"
INTERFACE_INCLUDE_DIRECTORIES "${dilithium_src_SOURCE_DIR}/ref/"
)
# The archive above is compiled with these defines via BUILD_COMMAND's CFLAGS;
# propagate them to every consumer so params.h resolves CRYPTO_PUBLICKEYBYTES /
# CRYPTO_SECRETKEYBYTES to the archive's sizes wherever it is included.
target_compile_definitions(dilithium::dilithium2_ref INTERFACE
DILITHIUM_MODE=2
DILITHIUM_RANDOMIZED_SIGNING
)
add_library(dilithium::libfips202_ref STATIC IMPORTED GLOBAL)
set_target_properties(dilithium::libfips202_ref PROPERTIES
IMPORTED_LOCATION "${dilithium_src_BINARY_DIR}/ref/libfips202_ref.a"
INTERFACE_INCLUDE_DIRECTORIES "${dilithium_src_SOURCE_DIR}/ref/"
)
# Add dependencies to ensure the external project is built first
add_dependencies(dilithium::dilithium2_ref dilithium_src)
add_dependencies(dilithium::libfips202_ref dilithium_src)
# The pinned ref/Makefile archives $(SOURCES:.c=.o) symmetric-shake.o fips202.o
# into libdilithium2_ref.a, and SOURCES has no randombytes.c, so the archive
# carries no randombytes definition. The only one at link time is the
# extern "C" randombytes in src/libxrpl/protocol/SecretKey.cpp, which draws
# from xrpl::cryptoPrng() rather than reading /dev/urandom directly.
# Create an interface library that links to the Dilithium libraries
# Note: Link order matters - libraries that provide symbols must come AFTER libraries that use them
target_link_libraries(xrpl_libs INTERFACE
dilithium::dilithium2_ref
dilithium::libfips202_ref
)
# Create alias for convenience
add_library(NIH::dilithium2_ref ALIAS dilithium::dilithium2_ref)

View File

@@ -61,6 +61,7 @@ SETTING_DEFAULTS = {
"delegable": "Delegation::NotDelegable",
"amendment": "uint256{}",
"privileges": "Privilege::NoPriv",
"firewall": "FirewallAction::Allow",
}

View File

@@ -8,6 +8,9 @@ cxx = { version = "1.0.198", features = ["c++20"] }
[workspace.package]
edition = "2024"
[workspace.lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = [ 'cfg(coverage)', 'cfg(coverage_nightly)' ] }
[profile.release]
opt-level = 3
overflow-checks = true

View File

@@ -8,3 +8,6 @@ crate-type = ["staticlib"]
[dependencies]
cxx.workspace = true
[lints]
workspace = true

View File

@@ -1,3 +1,5 @@
#![cfg_attr(coverage_nightly, feature(coverage_attribute))]
#[cxx::bridge(namespace = "rs::hello_world")]
mod ffi {
extern "Rust" {
@@ -8,3 +10,14 @@ mod ffi {
pub fn hello_world() -> String {
"hello_world".to_string()
}
#[cfg(test)]
#[cfg_attr(coverage_nightly, coverage(off))]
mod tests {
use super::*;
#[test]
fn hello_world_returns_hello_world() {
assert_eq!(hello_world(), "hello_world")
}
}

279
docs/AMMCurveTemplate.md Normal file
View File

@@ -0,0 +1,279 @@
# AMM Curve Implementation Template
Guide for adding a new curve type to the XRPL pluggable AMM curve framework.
## Architecture Overview
Each token pair can have **multiple AMM pools**, one per curve type. The keylet
hash includes `curveType`, so `RLUSD/USD ConstantProduct` and `RLUSD/USD
StableSwap` are separate ledger entries with separate pseudo-accounts and LP
tokens. BookStep automatically routes through the deepest-liquidity pool.
### Key Components
| Component | File | Purpose |
| --------------------- | --------------------------------------------------- | --------------------------------------- |
| CurveInterface | `include/xrpl/ledger/helpers/AMMCurve.h` | Abstract base for all curves |
| Curve implementations | `src/libxrpl/ledger/helpers/AMMCurve.cpp` | CP, CL, StableSwap, Weighted |
| Tick math | `src/libxrpl/ledger/helpers/AMMTickMath.cpp` | CL tick/sqrt price conversions |
| Fee collection | `src/libxrpl/tx/transactors/dex/AMMCollectFees.cpp` | CL position fee harvesting |
| Multi-curve routing | `src/libxrpl/tx/paths/BookStep.cpp` | Picks best pool per pair |
| Keylet hashing | `src/libxrpl/protocol/Indexes.cpp` | `amm(asset1, asset2, curveType)` |
| LP token identity | `src/libxrpl/protocol/AMMCore.cpp` | `ammLPTCurrency(cur1, cur2, curveType)` |
## Step 1: Define the Curve Type
Add to `include/xrpl/protocol/AMMCore.h`:
```cpp
enum CurveType : std::uint8_t
{
ctCONSTANT_PRODUCT = 0,
ctCONCENTRATED_LIQUIDITY = 1,
ctSTABLE_SWAP = 2,
ctWEIGHTED = 3,
ctYOUR_CURVE = N, // next available ID
};
```
## Step 2: Define SFields for Curve Parameters
Add to `include/xrpl/protocol/detail/sfields.macro`:
```cpp
// Use the appropriate type (UINT8, UINT16, UINT32, UINT64, UINT256, AMOUNT, etc.)
// Check existing field codes to avoid collisions.
TYPED_SFIELD(sfYourParam, UINT32, <next_available_code>)
```
## Step 3: Implement the CurveInterface
Add a new class in `src/libxrpl/ledger/helpers/AMMCurve.cpp`:
```cpp
class YourCurve final : public CurveInterface
{
public:
Expected<STAmount, TER>
swapIn(
STAmount const& poolIn,
STAmount const& poolOut,
STAmount const& assetIn,
std::uint16_t tfee,
STObject const* curveParams) const override
{
if (!curveParams)
return Unexpected(tecINTERNAL);
auto const param = curveParams->getFieldU32(sfYourParam);
auto const f = feeMult(tfee); // fee multiplier (1 - fee)
Number const x = poolIn; // STAmount -> Number via implicit conversion
Number const y = poolOut;
Number const dx = Number(assetIn) * f;
// --- YOUR INVARIANT MATH HERE ---
// Compute output amount `dy` from your invariant
// F(x, y) = k => F(x + dx, y - dy) = k => solve for dy
Number const dy = /* ... */;
if (dy <= Number{0})
return Unexpected(tecAMM_FAILED);
// Round output DOWN (favorable to pool)
NumberRoundModeGuard const mg(Number::downward);
return toSTAmount(poolOut.issue(), dy);
}
Expected<STAmount, TER>
swapOut(
STAmount const& poolIn,
STAmount const& poolOut,
STAmount const& assetOut,
std::uint16_t tfee,
STObject const* curveParams) const override
{
if (!curveParams)
return Unexpected(tecINTERNAL);
auto const param = curveParams->getFieldU32(sfYourParam);
auto const f = feeMult(tfee);
Number const x = poolIn;
Number const y = poolOut;
// --- YOUR INVARIANT MATH (INVERSE) ---
// Given desired output, compute required input
// F(x, y) = k => F(x + dx, y - assetOut) = k => solve for dx
Number const dx = /* ... */ / f;
if (dx <= Number{0})
return Unexpected(tecAMM_FAILED);
// Round input UP (favorable to pool)
NumberRoundModeGuard const mg(Number::upward);
return toSTAmount(poolIn.issue(), dx);
}
Expected<Number, TER>
spotPrice(
STAmount const& poolIn,
STAmount const& poolOut,
std::uint16_t tfee,
STObject const* curveParams) const override
{
if (!curveParams)
return Unexpected(tecINTERNAL);
auto const param = curveParams->getFieldU32(sfYourParam);
auto const f = feeMult(tfee);
// Marginal price: -dF/dx / dF/dy evaluated at current reserves
// Divided by (1 - fee) for the taker-facing price
Number const price = /* partial derivatives of your invariant */;
return price / f;
}
TER
validateParams(STObject const& curveParams) const override
{
// Validate curve-specific parameters at pool creation
if (!curveParams.isFieldPresent(sfYourParam))
return temMALFORMED;
auto const param = curveParams.getFieldU32(sfYourParam);
if (param < MIN_YOUR_PARAM || param > MAX_YOUR_PARAM)
return temMALFORMED;
return tesSUCCESS;
}
Expected<STAmount, TER>
initialLPTokens(
STAmount const& asset1,
STAmount const& asset2,
Issue const& lptIssue,
STObject const* curveParams) const override
{
if (!curveParams)
return Unexpected(tecINTERNAL);
// Compute initial LP token amount from deposits
// For many curves: geometric mean sqrt(asset1 * asset2)
// Or curve-specific: D for StableSwap, weighted geometric mean, etc.
Number const lp = /* ... */;
return toSTAmount(lptIssue, lp);
}
};
```
## Step 4: Register the Singleton and Dispatch
In `AMMCurve.cpp`, add the singleton and switch case:
```cpp
// At file scope (inside anonymous namespace)
static YourCurve const yourCurve_;
// In getCurve():
case ctYOUR_CURVE:
if (rules.enabled(featureAMMCurves))
return &yourCurve_;
return nullptr;
```
## Step 5: Update AMMCreate Validation
In `src/libxrpl/tx/transactors/dex/AMMCreate.cpp`:
1. Update the max curve type check: `if (curveType > ctYOUR_CURVE)`
2. Add params setup in the `applyGuts` section:
```cpp
else if (curveType == ctYOUR_CURVE)
{
ammSle->setFieldU32(
sfYourParam, ctx_.tx.getFieldU32(sfYourParam));
}
```
## Step 6: Multi-Curve Routing (BookStep)
BookStep automatically discovers and routes through the best pool for each
token pair. When a new curve type is added, update the loop upper bound in
`src/libxrpl/tx/paths/BookStep.cpp`:
```cpp
for (std::uint8_t ct = 0; ct <= ctYOUR_CURVE; ++ct)
{
auto const ammSle = ctx.view.read(keylet::amm(in, out, ct));
if (!ammSle || ammSle->getFieldAmount(sfLPTokenBalance) == beast::zero)
continue;
if (!bestAmm ||
ammSle->getFieldAmount(sfLPTokenBalance) >
bestAmm->getFieldAmount(sfLPTokenBalance))
bestAmm = ammSle;
}
```
The pool with the highest LP token balance wins. Curve-specific swap dispatch
happens automatically via `getCurve()` in `AMMLiquidity`/`AMMOffer`.
## Step 7: Keylet and LP Token Identity
Each curve type for the same token pair gets a unique ledger key and LP token:
- **Keylet**: `keylet::amm(asset1, asset2, curveType)` hashes `curveType` into
the AMM's ledger key (when curveType != 0, for backward compatibility)
- **LP token**: `ammLPTCurrency(cur1, cur2, curveType)` hashes `curveType` into
the LP token currency code
No changes needed here when adding a new curve — the default parameter
propagates automatically.
## Concentrated Liquidity Extras
The CL curve type uses additional infrastructure not needed by other curves:
- **AMMTickMath** (`AMMTickMath.h/cpp`): `tickToSqrtPrice()`, `sqrtPriceToTick()`,
`isValidTick()` for tick-based price representation
- **AMMCollectFees** (`AMMCollectFees.h/cpp`): Transactor for position owners to
collect accumulated swap fees using the Uniswap V3 fee growth formula
- **Ledger entries**: `ltAMM_POSITION` (per-user tick range + liquidity) and
`ltAMM_TICK` (per-tick fee growth and liquidity tracking)
- **SFields**: `sfFeeGrowthGlobal0/1`, `sfFeeGrowthOutside0/1`,
`sfFeeGrowthInsideLast0/1` (UINT256, Q128.128 fixed-point),
`sfActiveLiquidity`, `sfPositionLiquidity`, `sfLiquidityGross/Net` (UINT64)
## Math Utilities Available
- `Number`: arbitrary-precision decimal arithmetic (see `include/xrpl/basics/Number.h`)
- `power(f, n)`: f^n (integer exponent)
- `power(f, n, d)`: f^(n/d) (rational exponent)
- `root(f, d)`: f^(1/d)
- `root2(f)`: sqrt(f)
- `feeMult(tfee)`: returns `1 - fee` as Number
- `feeMultHalf(tfee)`: returns `1 - fee/2` as Number
- `toSTAmount(issue, number)`: convert Number to STAmount
- `NumberRoundModeGuard`: RAII guard for rounding direction
## Rounding Convention
- `swapIn` output: round DOWN (pool keeps the rounding dust)
- `swapOut` input: round UP (taker pays the rounding dust)
- Use `NumberRoundModeGuard` to set the rounding mode before `toSTAmount()`
## Testing
Add tests in `src/test/app/AMMCurves_test.cpp`:
1. `swapIn` and `swapOut` are inverses (within rounding tolerance)
2. Invariant is preserved: `F(reserves_new) >= F(reserves_old)` after every swap
3. `spotPrice` matches actual swap rate at infinitesimal amounts
4. Edge cases: zero input, max input, min reserves
5. Parameter validation: `validateParams` rejects out-of-range values
6. Integration: create pool, deposit, swap, withdraw full cycle
E2E tests go in `src/test/app/AMMCurvesE2E_test.cpp` for full transaction
lifecycle tests (AMMCreate with curve params, swap through payment engine,
deposit/withdraw).

View File

@@ -3,9 +3,84 @@
#include <algorithm>
#include <cassert>
#include <cstddef>
#include <cstdint>
#include <limits>
#include <optional>
namespace xrpl {
/**
* Add two signed 64-bit integers, returning std::nullopt when the exact
* mathematical sum is not representable in std::int64_t.
*/
[[nodiscard]] constexpr std::optional<std::int64_t>
checkedAdd(std::int64_t a, std::int64_t b) noexcept
{
using L = std::numeric_limits<std::int64_t>;
if ((b > 0 && a > L::max() - b) || (b < 0 && a < L::min() - b))
return std::nullopt;
return a + b;
}
/**
* Subtract two signed 64-bit integers, returning std::nullopt when the exact
* mathematical difference is not representable in std::int64_t.
*/
[[nodiscard]] constexpr std::optional<std::int64_t>
checkedSub(std::int64_t a, std::int64_t b) noexcept
{
using L = std::numeric_limits<std::int64_t>;
if ((b > 0 && a < L::min() + b) || (b < 0 && a > L::max() + b))
return std::nullopt;
return a - b;
}
static_assert(checkedAdd(0, 0) == 0);
static_assert(checkedAdd(1, -1) == 0);
static_assert(checkedAdd(-5, 2) == -3);
static_assert(!checkedAdd(std::numeric_limits<std::int64_t>::max(), 1).has_value());
static_assert(!checkedAdd(std::numeric_limits<std::int64_t>::min(), -1).has_value());
static_assert(
checkedAdd(std::numeric_limits<std::int64_t>::max() - 1, 1) ==
std::numeric_limits<std::int64_t>::max());
static_assert(
checkedAdd(
std::numeric_limits<std::int64_t>::min(),
std::numeric_limits<std::int64_t>::max()) == -1);
static_assert(
checkedAdd(
std::numeric_limits<std::int64_t>::max(),
std::numeric_limits<std::int64_t>::min()) == -1);
static_assert(
!checkedAdd(std::numeric_limits<std::int64_t>::max(), std::numeric_limits<std::int64_t>::max())
.has_value());
static_assert(
!checkedAdd(std::numeric_limits<std::int64_t>::min(), std::numeric_limits<std::int64_t>::min())
.has_value());
static_assert(checkedSub(0, 0) == 0);
static_assert(checkedSub(1, 1) == 0);
static_assert(checkedSub(-5, 2) == -7);
static_assert(checkedSub(-5, -2) == -3);
static_assert(!checkedSub(std::numeric_limits<std::int64_t>::min(), 1).has_value());
static_assert(!checkedSub(std::numeric_limits<std::int64_t>::max(), -1).has_value());
static_assert(
checkedSub(std::numeric_limits<std::int64_t>::min() + 1, 1) ==
std::numeric_limits<std::int64_t>::min());
static_assert(
checkedSub(-1, std::numeric_limits<std::int64_t>::max()) ==
std::numeric_limits<std::int64_t>::min());
static_assert(
!checkedSub(std::numeric_limits<std::int64_t>::max(), std::numeric_limits<std::int64_t>::min())
.has_value());
static_assert(
!checkedSub(std::numeric_limits<std::int64_t>::min(), std::numeric_limits<std::int64_t>::max())
.has_value());
/**
* Calculate one number divided by another number in percentage.
* The result is rounded up to the next integer, and capped in the range [0,100]

View File

@@ -82,4 +82,10 @@ base64Encode(std::string_view s)
std::string
base64Decode(std::string_view data);
/** Decode a base64url-encoded string (RFC 4648 S5).
Converts '-' to '+' and '_' to '/', adds padding, then decodes.
*/
std::string
base64urlDecode(std::string_view data);
} // namespace xrpl

View File

@@ -67,6 +67,7 @@ struct Sections
static constexpr auto kValidationSeed = "validation_seed";
static constexpr auto kValidatorKeys = "validator_keys";
static constexpr auto kValidatorKeyRevocation = "validator_key_revocation";
static constexpr auto kValidatorKeyType = "validator_key_type";
static constexpr auto kValidatorListKeys = "validator_list_keys";
static constexpr auto kValidatorListSites = "validator_list_sites";
static constexpr auto kValidatorListThreshold = "validator_list_threshold";

View File

@@ -528,6 +528,7 @@ public:
using iterator_category = std::bidirectional_iterator_tag;
using size_t = unsigned int;
using difference_type = int;
using value_type = Value;
using SelfType = ValueIteratorBase;
ValueIteratorBase();
@@ -598,6 +599,7 @@ public:
using value_type = Value const;
using reference = Value const&;
using pointer = Value const*;
using iterator_category = std::bidirectional_iterator_tag;
using SelfType = ValueConstIterator;
ValueConstIterator() = default;
@@ -663,6 +665,7 @@ public:
using value_type = Value;
using reference = Value&;
using pointer = Value*;
using iterator_category = std::bidirectional_iterator_tag;
using SelfType = ValueIterator;
ValueIterator() = default;

View File

@@ -78,6 +78,12 @@ public:
return base_.succ(key, last);
}
std::optional<key_type>
pred(key_type const& key, std::optional<key_type> const& first = std::nullopt) const override
{
return base_.pred(key, first);
}
std::unique_ptr<SlesType::iter_base>
slesBegin() const override
{

View File

@@ -186,6 +186,9 @@ public:
std::optional<uint256>
succ(uint256 const& key, std::optional<uint256> const& last = std::nullopt) const override;
std::optional<uint256>
pred(uint256 const& key, std::optional<uint256> const& first = std::nullopt) const override;
SLE::const_pointer
read(Keylet const& k) const override;

View File

@@ -221,6 +221,9 @@ public:
std::optional<key_type>
succ(key_type const& key, std::optional<key_type> const& last = std::nullopt) const override;
std::optional<key_type>
pred(key_type const& key, std::optional<key_type> const& first = std::nullopt) const override;
SLE::const_pointer
read(Keylet const& k) const override;

View File

@@ -154,6 +154,19 @@ public:
[[nodiscard]] virtual std::optional<key_type>
succ(key_type const& key, std::optional<key_type> const& last = std::nullopt) const = 0;
/** Return the key of the previous state item.
This returns the key of the first state item
whose key is less than the specified key. If
no such key is present, std::nullopt is returned.
If `first` is engaged, returns std::nullopt when
the key returned would be outside the open
interval (first, key).
*/
[[nodiscard]] virtual std::optional<key_type>
pred(key_type const& key, std::optional<key_type> const& first = std::nullopt) const = 0;
/**
* Return the state item associated with a key.
*

View File

@@ -71,6 +71,9 @@ public:
[[nodiscard]] std::optional<key_type>
succ(ReadView const& base, key_type const& key, std::optional<key_type> const& last) const;
[[nodiscard]] std::optional<key_type>
pred(ReadView const& base, key_type const& key, std::optional<key_type> const& first) const;
[[nodiscard]] SLE::const_pointer
read(ReadView const& base, Keylet const& k) const;

View File

@@ -50,6 +50,9 @@ public:
[[nodiscard]] std::optional<key_type>
succ(key_type const& key, std::optional<key_type> const& last = std::nullopt) const override;
[[nodiscard]] std::optional<key_type>
pred(key_type const& key, std::optional<key_type> const& first = std::nullopt) const override;
[[nodiscard]] SLE::const_pointer
read(Keylet const& k) const override;

View File

@@ -56,6 +56,9 @@ public:
[[nodiscard]] std::optional<key_type>
succ(ReadView const& base, key_type const& key, std::optional<key_type> const& last) const;
[[nodiscard]] std::optional<key_type>
pred(ReadView const& base, key_type const& key, std::optional<key_type> const& first) const;
void
erase(SLE::ref sle);

View File

@@ -0,0 +1,249 @@
// Pluggable AMM curve architecture.
// Concentrated liquidity (CurveType 1) based on XRPL-Standards Discussion #427
// by Roman Thpt (@RomThpt), which adapted Uniswap v3 tick math, fee tier
// structure, and fee accounting to the XRPL. This implementation extends that
// work with a pluggable curve interface, StableSwap, and Smart AMM.
// See: https://github.com/XRPLF/XRPL-Standards/discussions/427
#pragma once
#include <expected>
#include <xrpl/basics/Number.h>
#include <xrpl/ledger/helpers/AMMHelpers.h>
#include <xrpl/protocol/AMMCore.h>
#include <xrpl/protocol/AmountConversions.h>
#include <xrpl/protocol/Indexes.h>
#include <xrpl/protocol/Quality.h>
#include <xrpl/protocol/Rules.h>
#include <xrpl/protocol/SField.h>
#include <xrpl/protocol/STAmount.h>
#include <xrpl/protocol/STLedgerEntry.h>
#include <xrpl/protocol/STObject.h>
#include <xrpl/protocol/TER.h>
namespace xrpl {
class ReadView;
class ApplyView;
struct CurveContext
{
ReadView const* view = nullptr;
uint256 const* ammID = nullptr;
// Optional out: set to true if a CL swap-walk terminated because it hit
// maxTickCrossings. Callers pass a pointer when they want to detect
// the cap (e.g. to emit tecAMM_TICK_CAP_HIT); pass nullptr to ignore.
bool* tickCapHit = nullptr;
};
class CurveInterface
{
public:
virtual ~CurveInterface() = default;
virtual std::expected<STAmount, TER>
swapIn(
STAmount const& poolIn,
STAmount const& poolOut,
STAmount const& assetIn,
std::uint16_t tfee,
STObject const* ammSle,
CurveContext const& ctx = {}) const = 0;
virtual std::expected<STAmount, TER>
swapOut(
STAmount const& poolIn,
STAmount const& poolOut,
STAmount const& assetOut,
std::uint16_t tfee,
STObject const* ammSle,
CurveContext const& ctx = {}) const = 0;
virtual std::expected<Number, TER>
spotPrice(
STAmount const& poolIn,
STAmount const& poolOut,
std::uint16_t tfee,
STObject const* ammSle,
CurveContext const& ctx = {}) const = 0;
[[nodiscard]] virtual TER
validateParams(STObject const& tx) const = 0;
virtual std::expected<STAmount, TER>
initialLPTokens(
STAmount const& asset1,
STAmount const& asset2,
Issue const& lptIssue,
STObject const* txParams) const = 0;
virtual bool
checkInvariant(
STAmount const& oldIn,
STAmount const& oldOut,
STAmount const& newIn,
STAmount const& newOut,
STObject const* ammSle) const = 0;
// Apply a realized swap to the AMM SLE. Trustline balances are updated
// by the caller (BookStep). For CP and StableSwap the pool state is fully
// implicit in trustline balances, so the default is a no-op. CL must
// mutate currentTick/activeLiquidity/feeGrowthGlobal and flip
// feeGrowthOutside on crossed ticks, because none of that state is
// derivable from the trustlines alone.
virtual TER
applySwap(
ApplyView& /*view*/,
uint256 const& /*ammID*/,
STAmount const& /*assetIn*/,
STAmount const& /*assetOut*/,
std::uint16_t /*tfee*/,
STObject const* /*curveParams*/) const
{
return tesSUCCESS;
}
};
CurveInterface const*
getCurve(std::uint8_t curveType, Rules const& rules);
// Max output the pool can deliver before crossing the next initialised
// tick boundary in the swap direction. Audit #19: caller (AMMLiquidity's
// offer generation) uses this to cap an advertised AMM offer at the
// current tick range, so the offer's quality reflects only the marginal
// range — not a blended average across multiple tick crossings.
//
// Returns std::nullopt if there is no further tick in the swap direction
// (no cap; offer is bounded only by reserves) or if the pool has no
// active liquidity. Returns 0 if the swap is already at the boundary.
// Caller should treat nullopt as "no cap".
std::optional<Number>
maxClOutputWithinCurrentRange(
ReadView const& view,
uint256 const& ammID,
STObject const& ammSle,
bool zeroForOne);
// Equivalent for CtBinned: cap the advertised AMMOffer output at the
// active bin's reserve. Without this cap, AMMLiquidity quotes against
// the pool's aggregate balance — which spans multiple bins at different
// prices — and BookStep mispricesthe offer's quality vs CLOB. Capping
// per active bin lets BookStep iterate naturally, getting each bin's
// marginal price one offer at a time.
//
// Returns std::nullopt if no active bin exists (empty pool) or the
// active bin lacks the output asset.
std::optional<Number>
maxBinnedOutputAtActiveBin(
ReadView const& view,
uint256 const& ammID,
STObject const& ammSle,
bool inIsAsset0);
// ─── CL tick bitmap ─────────────────────────────────────────────────────
//
// Sparse 256-tick-per-word presence bitmap. See spec §3.6.
// Convert a tick to its (wordIndex, bitInWord) position. Offset-binary so
// arithmetic stays in unsigned domain. Uses kTickBitmapOffset (= -minTick)
// from AMMCore.h — single source of truth, do NOT duplicate inline.
inline std::pair<std::uint16_t, std::uint8_t>
tickToBitmapPos(std::int32_t tick) noexcept
{
auto const offsetT = static_cast<std::uint32_t>(
tick + static_cast<std::int32_t>(kTickBitmapOffset));
return {static_cast<std::uint16_t>(offsetT >> 8),
static_cast<std::uint8_t>(offsetT & 0xFFu)};
}
inline std::int32_t
bitmapPosToTick(std::uint16_t wordIndex, std::uint8_t bitInWord) noexcept
{
auto const offsetT =
(static_cast<std::uint32_t>(wordIndex) << 8) | bitInWord;
return static_cast<std::int32_t>(offsetT) -
static_cast<std::int32_t>(kTickBitmapOffset);
}
// Bit-test for the bitmap word storage. `bits` is the raw `sfBitmapBits`
// value read off the SLE. Convention: bit i = LSB of byte (i/8), little-
// endian within bytes. The convention is internal — callers that write
// bits must use the same scheme (and do, via the maintenance helpers).
inline bool
bitmapBitIsSet(uint256 const& bits, std::uint8_t pos) noexcept
{
return ((bits.data()[pos / 8]) >> (pos % 8)) & 1u;
}
// AMMDeposit and AMMWithdraw call these when a tick crosses the
// "initialised / uninitialised" boundary (sfLiquidityGross transitioning
// 0↔>0). Each pool has a sparse set of `ltAMM_TICK_BITMAP` SLEs covering
// 256 ticks each; setting / clearing creates and deletes those SLEs on
// demand. Idempotent — calling set on an already-set bit is a no-op.
//
// Returns tesSUCCESS on the happy path. The current implementation has
// no failure path beyond the AMM SLE being missing; reserved as TER for
// forward compatibility.
TER
setTickBitmap(ApplyView& view, uint256 const& ammID, std::int32_t tick, beast::Journal j);
TER
clearTickBitmap(ApplyView& view, uint256 const& ammID, std::int32_t tick, beast::Journal j);
inline std::uint8_t
getCurveType(SLE const& ammSle)
{
if (ammSle.isFieldPresent(sfCurveType))
return ammSle.getFieldU8(sfCurveType);
return CtConstantProduct;
}
template <typename TIn, typename TOut>
TOut
curveSwapIn(
TAmounts<TIn, TOut> const& pool,
TIn const& assetIn,
std::uint16_t tfee,
std::uint8_t curveType,
STObject const* ammSle,
CurveContext const& cctx = {})
{
if (curveType == CtConstantProduct)
return swapAssetIn(pool, assetIn, tfee);
if (auto const* curve = getCurve(curveType, *getCurrentTransactionRules()))
{
auto const stPoolIn = toSTAmount(pool.in);
auto const stPoolOut = toSTAmount(pool.out);
auto const stAssetIn = toSTAmount(assetIn);
if (auto const result = curve->swapIn(stPoolIn, stPoolOut, stAssetIn, tfee, ammSle, cctx))
return get<TOut>(*result);
}
return toAmount<TOut>(getAsset(pool.out), 0);
}
template <typename TIn, typename TOut>
TIn
curveSwapOut(
TAmounts<TIn, TOut> const& pool,
TOut const& assetOut,
std::uint16_t tfee,
std::uint8_t curveType,
STObject const* ammSle,
CurveContext const& cctx = {})
{
if (curveType == CtConstantProduct)
return swapAssetOut(pool, assetOut, tfee);
if (auto const* curve = getCurve(curveType, *getCurrentTransactionRules()))
{
auto const stPoolIn = toSTAmount(pool.in);
auto const stPoolOut = toSTAmount(pool.out);
auto const stAssetOut = toSTAmount(assetOut);
if (auto const result = curve->swapOut(stPoolIn, stPoolOut, stAssetOut, tfee, ammSle, cctx))
return get<TIn>(*result);
}
return toMaxAmount<TIn>(getAsset(pool.in));
}
} // namespace xrpl

View File

@@ -837,7 +837,8 @@ ammLPHolds(
Asset const& asset2,
AccountID const& ammAccount,
AccountID const& lpAccount,
beast::Journal const j);
beast::Journal const j,
std::uint8_t curveType = CtConstantProduct);
STAmount
ammLPHolds(
@@ -865,7 +866,12 @@ ammAccountHolds(ReadView const& view, AccountID const& ammAccountID, Asset const
* AMM object and account are deleted. Otherwise tecINCOMPLETE is returned.
*/
TER
deleteAMMAccount(Sandbox& view, Asset const& asset, Asset const& asset2, beast::Journal j);
deleteAMMAccount(
Sandbox& view,
Asset const& asset,
Asset const& asset2,
beast::Journal j,
std::uint8_t curveType = 0);
/**
* Initialize Auction and Voting slots and set the trading/discounted fee.

View File

@@ -0,0 +1,19 @@
#pragma once
#include <xrpl/basics/Number.h>
#include <xrpl/protocol/AMMCore.h>
#include <cstdint>
namespace xrpl {
Number
tickToSqrtPrice(std::int32_t tick);
std::int32_t
sqrtPriceToTick(Number const& sqrtPrice);
bool
isValidTick(std::int32_t tick, std::int32_t tickSpacing);
} // namespace xrpl

View File

@@ -338,6 +338,17 @@ adjustLoanBrokerOwnerCount(
[[nodiscard]] Rate
transferRate(ReadView const& view, AccountID const& issuer);
/**
* Returns the transfer fee charged for a specific currency of the issuer.
* A per-currency TransferFee on the currency's TokenIssuance overrides the
* account-wide TransferRate.
*/
[[nodiscard]] Rate
transferRate(ReadView const& view, AccountID const& issuer, Currency const& currency);
[[nodiscard]] Rate
transferRate(ReadView const& view, Issue const& issue);
/**
* Generate a pseudo-account address from a pseudo owner key.
* @param pseudoOwnerKey The key to generate the address from

View File

@@ -0,0 +1,49 @@
#pragma once
#include <xrpl/beast/utility/Journal.h>
#include <xrpl/ledger/ApplyView.h>
#include <xrpl/ledger/ReadView.h>
#include <xrpl/protocol/AccountID.h>
#include <xrpl/protocol/STAmount.h>
#include <xrpl/protocol/STLedgerEntry.h>
#include <xrpl/protocol/TER.h>
#include <cstdint>
namespace xrpl {
/**
* Settle a holder's accrued coupons on their MPToken.
*
* Adds units * (AccruedPerUnit - CouponIndex) to CouponAccrued, rounded
* once downward to the coupon asset, then advances CouponIndex to
* AccruedPerUnit. Units are MPTAmount + LockedAmount. Increments the
* schedule's ClaimantCount when CouponAccrued becomes non-zero on a
* holder that had none. The caller must view.update() both entries on
* tesSUCCESS.
*/
[[nodiscard]] TER
couponSettleMPToken(SLE::ref schedule, SLE::ref mptoken, beast::Journal j);
/**
* Settle a holder against the schedule of the issuance their MPToken
* belongs to, if that issuance carries lsfMPTCouponSchedule. Does
* nothing when the flag is clear, which is the case for every issuance
* without a coupon schedule.
*
* This is the entry point called from the MPT unit-change helpers.
*/
[[nodiscard]] TER
couponSettleIfScheduled(
ApplyView& view,
SLE::const_ref issuance,
SLE::ref mptoken,
beast::Journal j);
/**
* The units a holder is credited for: MPTAmount + LockedAmount.
*/
[[nodiscard]] std::uint64_t
couponHolderUnits(SLE::const_ref mptoken);
} // namespace xrpl

View File

@@ -2,8 +2,10 @@
#include <xrpl/basics/Log.h>
#include <xrpl/beast/utility/Journal.h>
#include <xrpl/beast/utility/Zero.h>
#include <xrpl/beast/utility/instrumentation.h>
#include <xrpl/ledger/ApplyView.h>
#include <xrpl/ledger/ReadView.h>
#include <xrpl/ledger/helpers/AccountRootHelpers.h>
#include <xrpl/ledger/helpers/MPTokenHelpers.h>
#include <xrpl/ledger/helpers/RippleStateHelpers.h>
@@ -27,6 +29,291 @@
namespace xrpl {
/**
* Validate that @p account may lock @p amount of a token for later delivery
* to @p dest.
*
* The lock-side counterpart of escrowUnlockPreclaimHelper: every issuer
* control (locking opt-in, authorization, freeze/lock, transferability,
* spendable balance) that gates locking token value lives here, so any
* transactor that locks funds applies the same rules. The signature is
* view-based rather than PreclaimContext-based so it can also run from
* doApply.
*/
template <ValidIssueType T>
TER
escrowLockPreclaimHelper(
ReadView const& view,
AccountID const& account,
AccountID const& dest,
STAmount const& amount,
beast::Journal j);
template <>
inline TER
escrowLockPreclaimHelper<Issue>(
ReadView const& view,
AccountID const& account,
AccountID const& dest,
STAmount const& amount,
beast::Journal j)
{
auto const& issue = amount.get<Issue>();
auto const& issuer = amount.getIssuer();
// If the issuer is the same as the account, return tecNO_PERMISSION
if (issuer == account)
return tecNO_PERMISSION;
// If the lsfAllowTrustLineLocking is not enabled, return tecNO_PERMISSION
auto const sleIssuer = view.read(keylet::account(issuer));
if (!sleIssuer)
return tecNO_ISSUER;
if (!sleIssuer->isFlag(lsfAllowTrustLineLocking))
return tecNO_PERMISSION;
// If the account does not have a trustline to the issuer, return tecNO_LINE
auto const sleRippleState = view.read(keylet::trustLine(account, issuer, issue.currency));
if (!sleRippleState)
return tecNO_LINE;
STAmount const balance = (*sleRippleState)[sfBalance];
// If balance is positive, issuer must have higher address than account
if (balance > beast::kZero && issuer < account)
return tecNO_PERMISSION; // LCOV_EXCL_LINE
// If balance is negative, issuer must have lower address than account
if (balance < beast::kZero && issuer > account)
return tecNO_PERMISSION; // LCOV_EXCL_LINE
// If the issuer has requireAuth set, check if the account is authorized
if (auto const ter = requireAuth(view, issue, account); !isTesSuccess(ter))
return ter;
// If the issuer has requireAuth set, check if the destination is authorized
if (auto const ter = requireAuth(view, issue, dest); !isTesSuccess(ter))
return ter;
// If the issuer has frozen the account, return tecFROZEN
if (isFrozen(view, account, issue))
return tecFROZEN;
// If the issuer has frozen the destination, return tecFROZEN
if (isFrozen(view, dest, issue))
return tecFROZEN;
STAmount const spendableAmount =
accountHolds(view, account, issue.currency, issuer, FreezeHandling::IgnoreFreeze, j);
// If the balance is less than or equal to 0, return tecINSUFFICIENT_FUNDS
if (spendableAmount <= beast::kZero)
return tecINSUFFICIENT_FUNDS;
// If the spendable amount is less than the amount, return
// tecINSUFFICIENT_FUNDS
if (spendableAmount < amount)
return tecINSUFFICIENT_FUNDS;
// If the amount is not addable to the balance, return tecPRECISION_LOSS
if (!canAdd(spendableAmount, amount))
return tecPRECISION_LOSS;
return tesSUCCESS;
}
template <>
inline TER
escrowLockPreclaimHelper<MPTIssue>(
ReadView const& view,
AccountID const& account,
AccountID const& dest,
STAmount const& amount,
beast::Journal j)
{
AccountID const issuer = amount.getIssuer();
// If the issuer is the same as the account, return tecNO_PERMISSION
if (issuer == account)
return tecNO_PERMISSION;
// If the mpt does not exist, return tecOBJECT_NOT_FOUND
auto const issuanceKey = keylet::mptokenIssuance(amount.get<MPTIssue>().getMptID());
auto const sleIssuance = view.read(issuanceKey);
if (!sleIssuance)
return tecOBJECT_NOT_FOUND;
// If the lsfMPTCanEscrow is not enabled, return tecNO_PERMISSION
if (!sleIssuance->isFlag(lsfMPTCanEscrow))
return tecNO_PERMISSION;
// If the issuer is not the same as the issuer of the mpt, return
// tecNO_PERMISSION
if (sleIssuance->getAccountID(sfIssuer) != issuer)
return tecNO_PERMISSION; // LCOV_EXCL_LINE
// If the account does not have the mpt, return tecOBJECT_NOT_FOUND
if (!view.exists(keylet::mptoken(issuanceKey.key, account)))
return tecOBJECT_NOT_FOUND;
// If the issuer has requireAuth set, check if the account is
// authorized
auto const& mptIssue = amount.get<MPTIssue>();
if (auto const ter = requireAuth(view, mptIssue, account, AuthType::WeakAuth);
!isTesSuccess(ter))
return ter;
// If the issuer has requireAuth set, check if the destination is
// authorized
if (auto const ter = requireAuth(view, mptIssue, dest, AuthType::WeakAuth); !isTesSuccess(ter))
return ter;
// If the issuer has frozen the account, return tecLOCKED
if (isFrozen(view, account, *sleIssuance))
return tecLOCKED;
// If the issuer has frozen the destination, return tecLOCKED
if (isFrozen(view, dest, *sleIssuance))
return tecLOCKED;
// If the mpt cannot be transferred, return tecNO_AUTH
if (auto const ter = canTransfer(view, mptIssue, account, dest); !isTesSuccess(ter))
return ter;
STAmount const spendableAmount = accountHolds(
view,
account,
amount.get<MPTIssue>(),
FreezeHandling::IgnoreFreeze,
AuthHandling::IgnoreAuth,
j);
// If the balance is less than or equal to 0, return tecINSUFFICIENT_FUNDS
if (spendableAmount <= beast::kZero)
return tecINSUFFICIENT_FUNDS;
// If the spendable amount is less than the amount, return
// tecINSUFFICIENT_FUNDS
if (spendableAmount < amount)
return tecINSUFFICIENT_FUNDS;
return tesSUCCESS;
}
template <ValidIssueType T>
TER
escrowLockApplyHelper(
ApplyView& view,
AccountID const& issuer,
AccountID const& sender,
STAmount const& amount,
beast::Journal journal);
template <>
inline TER
escrowLockApplyHelper<Issue>(
ApplyView& view,
AccountID const& issuer,
AccountID const& sender,
STAmount const& amount,
beast::Journal journal)
{
// Defensive: Issuer cannot create an escrow
if (issuer == sender)
return tecINTERNAL; // LCOV_EXCL_LINE
auto const ter =
directSendNoFee(view, sender, issuer, amount, !amount.holds<MPTIssue>(), journal);
if (!isTesSuccess(ter))
return ter; // LCOV_EXCL_LINE
return tesSUCCESS;
}
template <>
inline TER
escrowLockApplyHelper<MPTIssue>(
ApplyView& view,
AccountID const& issuer,
AccountID const& sender,
STAmount const& amount,
beast::Journal journal)
{
// Defensive: Issuer cannot create an escrow
if (issuer == sender)
return tecINTERNAL; // LCOV_EXCL_LINE
auto const ter = lockEscrowMPT(view, sender, amount, journal);
if (!isTesSuccess(ter))
return ter; // LCOV_EXCL_LINE
return tesSUCCESS;
}
template <ValidIssueType T>
TER
escrowUnlockPreclaimHelper(
ReadView const& view,
AccountID const& account,
STAmount const& amount,
bool checkFreeze = true);
template <>
inline TER
escrowUnlockPreclaimHelper<Issue>(
ReadView const& view,
AccountID const& account,
STAmount const& amount,
bool checkFreeze)
{
AccountID const& issuer = amount.getIssuer();
// If the issuer is the same as the account, return tesSUCCESS
if (issuer == account)
return tesSUCCESS;
// If the issuer has requireAuth set, check if the destination is authorized
if (auto const ter = requireAuth(view, amount.get<Issue>(), account); !isTesSuccess(ter))
return ter;
// If the issuer has deep frozen the destination, return tecFROZEN
if (checkFreeze &&
isDeepFrozen(view, account, amount.get<Issue>().currency, amount.getIssuer()))
return tecFROZEN;
return tesSUCCESS;
}
template <>
inline TER
escrowUnlockPreclaimHelper<MPTIssue>(
ReadView const& view,
AccountID const& account,
STAmount const& amount,
bool checkFreeze)
{
AccountID const& issuer = amount.getIssuer();
// If the issuer is the same as the account, return tesSUCCESS
if (issuer == account)
return tesSUCCESS;
// If the mpt does not exist, return tecOBJECT_NOT_FOUND
auto const issuanceKey = keylet::mptokenIssuance(amount.get<MPTIssue>().getMptID());
auto const sleIssuance = view.read(issuanceKey);
if (!sleIssuance)
return tecOBJECT_NOT_FOUND;
// If the issuer has requireAuth set, check if the account is
// authorized
auto const& mptIssue = amount.get<MPTIssue>();
if (auto const ter = requireAuth(view, mptIssue, account, AuthType::WeakAuth);
!isTesSuccess(ter))
return ter;
// If the issuer has frozen the account, return tecLOCKED
if (checkFreeze && isFrozen(view, account, *sleIssuance))
return tecLOCKED;
return tesSUCCESS;
}
//------------------------------------------------------------------------------
template <ValidIssueType T>
TER
escrowUnlockApplyHelper(
@@ -55,9 +342,6 @@ escrowUnlockApplyHelper<Issue>(
bool createAsset,
beast::Journal journal)
{
auto const& issue = amount.get<Issue>();
Keylet const trustLineKey = keylet::trustLine(receiver, issue);
bool const recvLow = issuer > receiver;
bool const senderIssuer = issuer == sender;
bool const receiverIssuer = issuer == receiver;
@@ -67,6 +351,10 @@ escrowUnlockApplyHelper<Issue>(
if (receiverIssuer)
return tesSUCCESS;
auto const& issue = amount.get<Issue>();
Keylet const trustLineKey = keylet::trustLine(receiver, issue);
bool const recvLow = issuer > receiver;
if (!ctx.view.exists(trustLineKey) && createAsset)
{
// Can the account cover the trust line's reserve?

View File

@@ -101,6 +101,24 @@ static constexpr std::uint32_t kSecondsInYear = 365 * 24 * 60 * 60;
Number
loanPeriodicRate(TenthBips32 interestRate, std::uint32_t paymentInterval);
/**
* Assets a loan earns per second at this principal outstanding.
*
* Equation (27) of XLS-66 is linear in elapsed time, and sfPaymentInterval
* cancels out of it, so a loan's accrual rate depends only on its principal
* and interest rate. Principal is flat between payments, which makes the rate
* piecewise-constant with breakpoints exactly at the events that update it —
* summing it across a vault's loans is therefore exact, not an approximation.
*/
inline Number
loanAccrualRate(Number const& principalOutstanding, TenthBips32 interestRate)
{
if (interestRate == TenthBips32{0} || principalOutstanding <= Number{})
return Number{};
return tenthBipsOfValue(principalOutstanding, interestRate) / Number{kSecondsInYear};
}
/**
* Ensure the periodic payment is always rounded consistently
*/

View File

@@ -132,6 +132,29 @@ authorizeMPToken(
std::uint32_t flags = 0,
std::optional<AccountID> holderID = std::nullopt);
// Authorize an AMM-issued MPT and apply the reserve-exemption rule in
// one shot: standard authorize (which increments owner count) followed
// by an immediate adjustOwnerCount(-1) so the LP doesn't pay reserve
// for the AMM-issued holding. Returns the same TER as authorizeMPToken.
//
// Callers must ensure the MPT's issuance is owned by an AMM pseudo-
// account; mis-using this helper for non-AMM-issued MPTs would let an
// LP hold an arbitrary issuer's MPT for free.
[[nodiscard]] TER
authorizeAMMIssuedMPT(
ApplyViewContext ctx,
XRPAmount const& priorBalance,
MPTID const& mptIssuanceID,
AccountID const& account,
beast::Journal journal);
// Symmetric for snapshot-style SLEs the AMM owns on behalf of an LP
// (e.g. ltAMM_BIN_HOLDING). The SLE is inserted into the LP's owner
// directory by the caller; this helper compensates the owner-count
// increment so the LP doesn't pay reserve.
void
exemptAMMOwnedSLE(ApplyView& view, AccountID const& account, beast::Journal journal);
/**
* Check if the account lacks required authorization for MPT.
*

View File

@@ -2,28 +2,85 @@
#include <xrpl/basics/base_uint.h>
#include <xrpl/beast/utility/Journal.h>
#include <xrpl/beast/utility/Zero.h>
#include <xrpl/ledger/ApplyView.h>
#include <xrpl/protocol/AccountID.h>
#include <xrpl/protocol/Concepts.h>
#include <xrpl/protocol/Feature.h>
#include <xrpl/protocol/Issue.h>
#include <xrpl/protocol/MPTAmount.h>
#include <xrpl/protocol/MPTIssue.h>
#include <xrpl/protocol/Protocol.h>
#include <xrpl/protocol/Rules.h>
#include <xrpl/protocol/STAmount.h>
#include <xrpl/protocol/STLedgerEntry.h>
#include <xrpl/protocol/TER.h>
#include <xrpl/protocol/UintTypes.h>
#include <cstdint>
#include <optional>
namespace xrpl {
/**
* Validate the token amount of a PaymentChannelCreate or PaymentChannelFund
* transaction during preflight.
*
* @param rules The current ledger rules used to check amendment status.
* @param amount The channel or funding amount from the transaction.
* @return tesSUCCESS if the amount is valid; temBAD_AMOUNT, temBAD_CURRENCY,
* or temDISABLED otherwise.
*/
template <ValidIssueType T>
NotTEC
payChanAmountPreflightHelper(Rules const& rules, STAmount const& amount);
template <>
inline NotTEC
payChanAmountPreflightHelper<Issue>(Rules const&, STAmount const& amount)
{
if (amount.native() || amount <= beast::kZero)
return temBAD_AMOUNT;
if (badCurrency() == amount.get<Issue>().currency)
return temBAD_CURRENCY;
return tesSUCCESS;
}
template <>
inline NotTEC
payChanAmountPreflightHelper<MPTIssue>(Rules const& rules, STAmount const& amount)
{
if (!rules.enabled(fixCleanup3_2_0) && !rules.enabled(featureMPTokensV1))
return temDISABLED;
if (amount.native() || amount.mpt() > MPTAmount{kMaxMpTokenAmount} || amount <= beast::kZero)
return temBAD_AMOUNT;
return tesSUCCESS;
}
/**
* Close a payment channel and return its remaining funds to the channel owner.
*
* @param slep The SLE for the PayChannel object to close.
* @param view The apply view in which ledger state modifications are made.
* @param key The ledger key identifying the PayChannel entry.
* @param j Journal used for fatal-level diagnostic messages.
* @return tesSUCCESS on success; tefBAD_LEDGER if a directory removal
* fails; tefINTERNAL if the source account SLE cannot be found.
* @param slep The SLE for the PayChannel object to close.
* @param ctx The apply view context (view and transaction) in which ledger
* state modifications are made.
* @param key The ledger key identifying the PayChannel entry.
* @param txAccount The account submitting the transaction that closes the
* channel.
* @param j Journal used for fatal-level diagnostic messages.
* @return tesSUCCESS on success; tefBAD_LEDGER if a directory removal
* fails; tefINTERNAL if the source account SLE cannot be found.
*/
TER
closeChannel(SLE::ref slep, ApplyView& view, uint256 const& key, beast::Journal j);
closeChannel(
SLE::ref slep,
ApplyViewContext ctx,
uint256 const& key,
AccountID const& txAccount,
beast::Journal j);
/**
* Add two uint32_t values with saturation at UINT32_MAX.

View File

@@ -0,0 +1,85 @@
#pragma once
#include <xrpl/beast/utility/Journal.h>
#include <xrpl/ledger/ApplyView.h>
#include <xrpl/ledger/ReadView.h>
#include <xrpl/protocol/AccountID.h>
#include <xrpl/protocol/Asset.h>
#include <xrpl/protocol/STAmount.h>
#include <xrpl/protocol/STLedgerEntry.h>
#include <xrpl/protocol/TER.h>
#include <cstdint>
namespace xrpl {
namespace repo {
/**
* Seconds in a year, the denominator of the annualized interest rate.
*/
/**
* A repo is active once the buyer has accepted it, which is recorded by
* sfStartDate. Before that it is a pending offer.
*/
[[nodiscard]] inline bool
isActive(SLE::const_ref sleRepo)
{
return sleRepo->isFieldPresent(sfStartDate);
}
/**
* The amount the seller owes to repurchase the collateral.
*
* PurchasePrice * (1 + InterestRate * elapsed / kSecondsInYear), where elapsed
* runs from StartDate to the close time, capped at MaturityDate so the seller
* never pays for time past maturity. Computed in Number and rounded up, so
* rounding never favours the seller.
*/
[[nodiscard]] STAmount
repurchaseAmount(SLE::const_ref sleRepo, std::uint32_t closeTime);
/**
* Lock the collateral out of the seller's spendable balance.
*
* XRP is deducted from the account balance by the caller; this handles the
* issued-asset cases the same way an escrow does.
*/
[[nodiscard]] TER
lockCollateral(
ApplyView& view,
AccountID const& issuer,
AccountID const& seller,
STAmount const& amount,
beast::Journal journal);
/**
* The XLS-85 checks that decide whether collateral may be locked at all.
*
* Both parties are checked, not just the seller: the buyer receives the
* collateral if the repo defaults, so an unauthorized or frozen buyer would
* leave the collateral unable to move at exactly the moment it must.
*/
[[nodiscard]] TER
checkCollateral(
ReadView const& view,
AccountID const& seller,
AccountID const& buyer,
STAmount const& collateral,
beast::Journal journal);
/**
* Return the locked collateral to an account and remove the entry.
*
* Used by cancel, close and default; they differ only in who receives the
* collateral and whether any cash moved first.
*/
[[nodiscard]] TER
releaseAndDelete(
ApplyViewContext ctx,
SLE::ref sleRepo,
AccountID const& receiver,
beast::Journal journal);
} // namespace repo
} // namespace xrpl

View File

@@ -0,0 +1,429 @@
#pragma once
#include <xrpl/basics/Log.h>
#include <xrpl/beast/utility/Journal.h>
#include <xrpl/beast/utility/Zero.h>
#include <xrpl/ledger/ApplyView.h>
#include <xrpl/ledger/ReadView.h>
#include <xrpl/ledger/helpers/AccountRootHelpers.h>
#include <xrpl/ledger/helpers/MPTokenHelpers.h>
#include <xrpl/ledger/helpers/RippleStateHelpers.h>
#include <xrpl/ledger/helpers/TokenHelpers.h>
#include <xrpl/protocol/AccountID.h>
#include <xrpl/protocol/Concepts.h>
#include <xrpl/protocol/Indexes.h>
#include <xrpl/protocol/Issue.h>
#include <xrpl/protocol/Keylet.h>
#include <xrpl/protocol/LedgerFormats.h>
#include <xrpl/protocol/MPTIssue.h>
#include <xrpl/protocol/SField.h>
#include <xrpl/protocol/STAmount.h>
#include <xrpl/protocol/STLedgerEntry.h>
#include <xrpl/protocol/TER.h>
#include <xrpl/protocol/UintTypes.h>
#include <cstdint>
namespace xrpl {
template <ValidIssueType T>
TER
canTransferTokenHelper(
ReadView const& view,
AccountID const& account,
AccountID const& dest,
STAmount const& amount,
beast::Journal const& j);
template <>
inline TER
canTransferTokenHelper<Issue>(
ReadView const& view,
AccountID const& account,
AccountID const& dest,
STAmount const& amount,
beast::Journal const& j)
{
AccountID issuer = amount.getIssuer();
if (issuer == account)
{
JLOG(j.trace()) << "canTransferTokenHelper: Issuer is the same as the account.";
return tesSUCCESS;
}
// If the issuer does not exist, return tecNO_ISSUER
auto const sleIssuer = view.read(keylet::account(issuer));
if (!sleIssuer)
{
JLOG(j.trace()) << "canTransferTokenHelper: Issuer does not exist.";
return tecNO_ISSUER;
}
// If the account does not have a trustline to the issuer, return tecNO_LINE
auto const sleRippleState =
view.read(keylet::trustLine(account, issuer, amount.get<Issue>().currency));
if (!sleRippleState)
{
JLOG(j.trace()) << "canTransferTokenHelper: Trust line does not exist.";
return tecNO_LINE;
}
STAmount const balance = (*sleRippleState)[sfBalance];
// If balance is positive, issuer must have higher address than account
if (balance > beast::kZero && issuer < account)
{
JLOG(j.trace()) << "canTransferTokenHelper: Invalid trust line state.";
return tecNO_PERMISSION;
}
// If balance is negative, issuer must have lower address than account
if (balance < beast::kZero && issuer > account)
{
JLOG(j.trace()) << "canTransferTokenHelper: Invalid trust line state.";
return tecNO_PERMISSION;
}
// If the issuer has requireAuth set, check if the account is authorized
if (auto const ter = requireAuth(view, amount.get<Issue>(), account); ter != tesSUCCESS)
{
JLOG(j.trace()) << "canTransferTokenHelper: Account is not authorized";
return ter;
}
// If the issuer has requireAuth set, check if the destination is authorized
if (auto const ter = requireAuth(view, amount.get<Issue>(), dest); ter != tesSUCCESS)
{
JLOG(j.trace()) << "canTransferTokenHelper: Destination is not authorized.";
return ter;
}
// If the issuer has frozen the account, return tecFROZEN
if (isFrozen(view, account, amount.get<Issue>()) ||
isDeepFrozen(view, account, amount.get<Issue>().currency, amount.get<Issue>().account))
{
JLOG(j.trace()) << "canTransferTokenHelper: Account is frozen.";
return tecFROZEN;
}
// If the issuer has frozen the destination, return tecFROZEN
if (isFrozen(view, dest, amount.get<Issue>()) ||
isDeepFrozen(view, dest, amount.get<Issue>().currency, amount.get<Issue>().account))
{
JLOG(j.trace()) << "canTransferTokenHelper: Destination is frozen.";
return tecFROZEN;
}
STAmount const spendableAmount = accountHolds(
view, account, amount.get<Issue>().currency, issuer, FreezeHandling::IgnoreFreeze, j);
// If the balance is less than or equal to 0, return
// tecINSUFFICIENT_FUNDS
if (spendableAmount <= beast::kZero)
{
JLOG(j.trace()) << "canTransferTokenHelper: Spendable amount is less "
"than or equal to 0.";
return tecINSUFFICIENT_FUNDS;
}
// If the spendable amount is less than the amount, return
// tecINSUFFICIENT_FUNDS
if (spendableAmount < amount)
{
JLOG(j.trace()) << "canTransferTokenHelper: Spendable amount is less "
"than the amount.";
return tecINSUFFICIENT_FUNDS;
}
// If the amount is not addable to the balance, return tecPRECISION_LOSS
if (!canAdd(spendableAmount, amount))
return tecPRECISION_LOSS;
return tesSUCCESS;
}
template <>
inline TER
canTransferTokenHelper<MPTIssue>(
ReadView const& view,
AccountID const& account,
AccountID const& dest,
STAmount const& amount,
beast::Journal const& j)
{
AccountID issuer = amount.getIssuer();
if (issuer == account)
{
JLOG(j.trace()) << "canTransferTokenHelper: Issuer is the same as the account.";
return tesSUCCESS;
}
// If the mpt does not exist, return tecOBJECT_NOT_FOUND
auto const issuanceKey = keylet::mptokenIssuance(amount.get<MPTIssue>().getMptID());
auto const sleIssuance = view.read(issuanceKey);
if (!sleIssuance)
{
JLOG(j.trace()) << "canTransferTokenHelper: MPT issuance does not exist.";
return tecOBJECT_NOT_FOUND;
}
// If the issuer is not the same as the issuer of the mpt, return
// tecNO_PERMISSION
if (sleIssuance->getAccountID(sfIssuer) != issuer)
{
JLOG(j.trace()) << "canTransferTokenHelper: Issuer is not the same as "
"the issuer of the MPT.";
return tecNO_PERMISSION;
}
// If the account does not have the mpt, return tecOBJECT_NOT_FOUND
if (!view.exists(keylet::mptoken(issuanceKey.key, account)))
{
JLOG(j.trace()) << "canTransferTokenHelper: Account does not have the MPT.";
return tecOBJECT_NOT_FOUND;
}
// If the issuer has requireAuth set, check if the account is
// authorized
auto const& mptIssue = amount.get<MPTIssue>();
if (auto const ter = requireAuth(view, mptIssue, account, AuthType::WeakAuth);
ter != tesSUCCESS)
{
JLOG(j.trace()) << "canTransferTokenHelper: Account is not authorized.";
return ter;
}
// If the issuer has requireAuth set, check if the destination is
// authorized
if (auto const ter = requireAuth(view, mptIssue, dest, AuthType::WeakAuth); ter != tesSUCCESS)
{
JLOG(j.trace()) << "canTransferTokenHelper: Destination is not authorized.";
return ter;
}
// If the issuer has locked the account, return tecLOCKED
if (isFrozen(view, account, mptIssue))
{
JLOG(j.trace()) << "canTransferTokenHelper: Account is locked.";
return tecLOCKED;
}
// If the issuer has locked the destination, return tecLOCKED
if (isFrozen(view, dest, mptIssue))
{
JLOG(j.trace()) << "canTransferTokenHelper: Destination is locked.";
return tecLOCKED;
}
// If the mpt cannot be transferred, return tecNO_AUTH
if (auto const ter = canTransfer(view, mptIssue, account, dest); ter != tesSUCCESS)
{
JLOG(j.trace()) << "canTransferTokenHelper: MPT cannot be transferred.";
return ter;
}
STAmount const spendableAmount = accountHolds(
view,
account,
amount.get<MPTIssue>(),
FreezeHandling::IgnoreFreeze,
AuthHandling::IgnoreAuth,
j);
// If the balance is less than or equal to 0, return
// tecINSUFFICIENT_FUNDS
if (spendableAmount <= beast::kZero)
{
JLOG(j.trace()) << "canTransferTokenHelper: Spendable amount is less "
"than or equal to 0.";
return tecINSUFFICIENT_FUNDS;
}
// If the spendable amount is less than the amount, return
// tecINSUFFICIENT_FUNDS
if (spendableAmount < amount)
{
JLOG(j.trace()) << "canTransferTokenHelper: Spendable amount is less "
"than the amount.";
return tecINSUFFICIENT_FUNDS;
}
// If the amount is not addable to the balance, return tecPRECISION_LOSS
if (!canAdd(spendableAmount, amount))
return tecPRECISION_LOSS;
return tesSUCCESS;
}
template <ValidIssueType T>
TER
doTransferTokenHelper(
ApplyView& view,
SLE::ref sleDest,
STAmount const& xrpBalance,
STAmount const& amount,
AccountID const& issuer,
AccountID const& sender,
AccountID const& receiver,
bool createAsset,
beast::Journal journal);
template <>
inline TER
doTransferTokenHelper<Issue>(
ApplyView& view,
SLE::ref sleDest,
STAmount const& xrpBalance,
STAmount const& amount,
AccountID const& issuer,
AccountID const& sender,
AccountID const& receiver,
bool createAsset,
beast::Journal journal)
{
Keylet const trustLineKey = keylet::trustLine(receiver, amount.get<Issue>());
bool const recvLow = issuer > receiver;
// Review Note: We could remove this and just say to use batch to auth the
// token first
if (!view.exists(trustLineKey) && createAsset && issuer != receiver)
{
// Can the account cover the trust line's reserve?
if (xrpBalance < accountReserve(view, sleDest, journal, {.ownerCountDelta = 1}))
{
JLOG(journal.trace()) << "doTransferTokenHelper: Trust line does not exist. "
"Insufficent reserve to create line.";
return tecNO_LINE_INSUF_RESERVE;
}
Currency const currency = amount.get<Issue>().currency;
STAmount initialBalance(amount.get<Issue>());
initialBalance.get<Issue>().account = noAccount();
// clang-format off
if (TER const ter = trustCreate(
view, // payment sandbox
recvLow, // is dest low?
issuer, // source
receiver, // destination
trustLineKey.key, // ledger index
sleDest, // Account to add to
false, // authorize account
(sleDest->getFlags() & lsfDefaultRipple) == 0,
false, // freeze trust line
false, // deep freeze trust line
initialBalance, // zero initial balance
Issue(currency, receiver), // limit of zero
0, // quality in
0, // quality out
SLE::pointer(), // sponsor
journal); // journal
!isTesSuccess(ter))
{
JLOG(journal.trace()) << "doTransferTokenHelper: Failed to create trust line: " << transToken(ter);
return ter;
}
// clang-format on
view.update(sleDest);
}
if (!view.exists(trustLineKey) && issuer != receiver)
return tecNO_LINE;
auto const ter =
accountSend(view, sender, receiver, amount, journal, SLE::pointer(), WaiveTransferFee::No);
if (ter != tesSUCCESS)
{
JLOG(journal.trace()) << "doTransferTokenHelper: Failed to send token: " << transToken(ter);
return ter; // LCOV_EXCL_LINE
}
return tesSUCCESS;
}
template <>
inline TER
doTransferTokenHelper<MPTIssue>(
ApplyView& view,
SLE::ref sleDest,
STAmount const& xrpBalance,
STAmount const& amount,
AccountID const& issuer,
AccountID const& sender,
AccountID const& receiver,
bool createAsset,
beast::Journal journal)
{
auto const mptID = amount.get<MPTIssue>().getMptID();
auto const issuanceKey = keylet::mptokenIssuance(mptID);
if (!view.exists(keylet::mptoken(issuanceKey.key, receiver)) && createAsset &&
issuer != receiver)
{
if (xrpBalance < accountReserve(view, sleDest, journal, {.ownerCountDelta = 1}))
{
JLOG(journal.trace()) << "doTransferTokenHelper: MPT does not exist. "
"Insufficent reserve to create MPT.";
return tecINSUFFICIENT_RESERVE;
}
if (auto const ter = createMPToken(view, mptID, receiver, SLE::pointer(), 0);
!isTesSuccess(ter))
{
JLOG(journal.trace()) << "doTransferTokenHelper: Failed to create MPT: "
<< transToken(ter);
return ter;
}
// Update owner count.
increaseOwnerCount(view, sleDest, SLE::pointer(), 1, journal);
}
if (issuer != receiver && !view.exists(keylet::mptoken(issuanceKey.key, receiver)))
{
JLOG(journal.trace()) << "doTransferTokenHelper: MPT does not exist.";
return tecNO_PERMISSION;
}
auto const ter =
accountSend(view, sender, receiver, amount, journal, SLE::pointer(), WaiveTransferFee::No);
if (ter != tesSUCCESS)
{
JLOG(journal.trace()) << "doTransferTokenHelper: Failed to send MPT: " << transToken(ter);
return ter; // LCOV_EXCL_LINE
}
return tesSUCCESS;
}
// Remove a subscription from both owner directories, release the owner's
// reserve, and erase the object. Shared by SubscriptionCancel and the
// single-use claim path so the two never diverge.
inline TER
deleteSubscription(ApplyView& view, SLE::ref sleSub, beast::Journal journal)
{
AccountID const account{sleSub->getAccountID(sfAccount)};
AccountID const dstAcct{sleSub->getAccountID(sfDestination)};
std::uint64_t const ownerPage{(*sleSub)[sfOwnerNode]};
if (!view.dirRemove(keylet::ownerDir(account), ownerPage, sleSub->key(), true))
{
JLOG(journal.fatal()) << "deleteSubscription: Unable to delete from source.";
return tefBAD_LEDGER;
}
std::uint64_t const destPage{(*sleSub)[sfDestinationNode]};
if (!view.dirRemove(keylet::ownerDir(dstAcct), destPage, sleSub->key(), true))
{
JLOG(journal.fatal()) << "deleteSubscription: Unable to delete from destination.";
return tefBAD_LEDGER;
}
auto const sleSrc = view.peek(keylet::account(account));
decreaseOwnerCount(view, sleSrc, SLE::pointer(), 1, journal);
view.erase(sleSub);
return tesSUCCESS;
}
} // namespace xrpl

View File

@@ -4,6 +4,7 @@
#include <xrpl/beast/utility/Journal.h>
#include <xrpl/ledger/ApplyView.h>
#include <xrpl/ledger/ReadView.h>
#include <xrpl/ledger/helpers/TokenIssuanceHelpers.h>
#include <xrpl/protocol/AccountID.h>
#include <xrpl/protocol/Asset.h>
#include <xrpl/protocol/Issue.h>
@@ -391,7 +392,8 @@ directSendNoFee(
AccountID const& uReceiverID,
STAmount const& saAmount,
bool bCheckIssuer,
beast::Journal j);
beast::Journal j,
EnforceSupplyCap enforceSupplyCap = EnforceSupplyCap::Yes);
/**
* Calls static accountSendIOU if saAmount represents Issue.

View File

@@ -0,0 +1,109 @@
#pragma once
#include <xrpl/basics/Number.h>
#include <xrpl/beast/utility/Journal.h>
#include <xrpl/ledger/ApplyView.h>
#include <xrpl/ledger/ReadView.h>
#include <xrpl/protocol/AccountID.h>
#include <xrpl/protocol/Issue.h>
#include <xrpl/protocol/STAmount.h>
#include <xrpl/protocol/STLedgerEntry.h>
#include <xrpl/protocol/TER.h>
#include <xrpl/protocol/UintTypes.h>
#include <cstdint>
#include <optional>
namespace xrpl {
/**
* ceil(value * 10^scale), exact.
*
* The shift is a pure exponent adjustment; the +1 for a fractional
* positive value is exact because a fractional Number is < 10^16.
* Truncation toward zero already is the ceiling for negative values.
*/
[[nodiscard]] Number
tokenScaledCeil(Number const& value, std::uint8_t scale);
/**
* floor(value * 10^scale) as integer base units; nullopt if it does not
* fit in a non-negative int64.
*/
[[nodiscard]] std::optional<std::int64_t>
tokenBaseUnits(Number const& value, std::uint8_t scale);
/**
* True if the issuance violates
* ceil(IssuedAmount * 10^TokenScale) + MPT OutstandingAmount > MaximumAmount.
* Always false for an uncapped issuance.
*/
[[nodiscard]] bool
tokenSupplyExceeded(ReadView const& view, SLE::const_ref sleIssuance);
/**
* Controls whether an IOU credit hard-fails when a capped TokenIssuance
* would exceed its MaximumAmount. Flow-engine steps pass No: their send
* results are advisory (return values ignored, reverse-pass execution can
* legitimately overshoot transiently) and the supply-cap invariant checker
* gates the final state instead.
*/
enum class EnforceSupplyCap : bool { No = false, Yes = true };
/**
* Maintain IssuedAmount on the issuer's TokenIssuance for a trust-line
* balance move of `amount` from `sender` to `receiver`. Only the amount's
* issuer is adjusted: balance moving away from the issuer increases its
* net issuance, balance returning decreases it.
*
* No-op when the amendment is disabled, neither party is the issuer, or no
* TokenIssuance exists. Returns tecSUPPLY_EXCEEDED when the cap is enforced
* and a capped issuer would exceed MaximumAmount.
*/
[[nodiscard]] TER
adjustTokenIssuance(
ApplyView& view,
AccountID const& sender,
AccountID const& receiver,
STAmount const& amount,
EnforceSupplyCap enforceCap,
beast::Journal j);
/**
* Remaining IOU the issuer can issue under the supply cap, floored to the
* representable amount; nullopt when there is no TokenIssuance or no cap.
*/
[[nodiscard]] std::optional<STAmount>
tokenIssuanceHeadroom(ReadView const& view, Issue const& issue);
/**
* True when the issue's TokenIssuance carries the per-currency lock
* (lsfTokenLocked). The per-currency analog of lsfGlobalFreeze.
*/
[[nodiscard]] bool
isTokenLocked(ReadView const& view, Issue const& issue);
/**
* For an MPT issuance bound to a capped TokenIssuance: the additional MPT
* base units that can be minted under the shared cap
* (MaximumAmount - OutstandingAmount - ceil(IssuedAmount * 10^TokenScale)).
* nullopt when unbound or uncapped.
*/
[[nodiscard]] std::optional<std::int64_t>
mptBoundHeadroom(ReadView const& view, SLE::const_ref sleMptIssuance);
/**
* Validate binding an MPTokenIssuance to a TokenIssuance: the MPT issuance
* exists, is issued by `account`, is not already bound, and its
* MaximumAmount/AssetScale equal the TokenIssuance's MaximumAmount/
* TokenScale.
*/
[[nodiscard]] TER
validateTokenBinding(
ReadView const& view,
MPTID const& mptId,
AccountID const& account,
std::optional<std::uint64_t> const& maximumAmount,
std::uint8_t tokenScale);
} // namespace xrpl

View File

@@ -1,6 +1,7 @@
#pragma once
#include <xrpl/basics/Number.h>
#include <xrpl/ledger/ApplyView.h>
#include <xrpl/ledger/ReadView.h>
#include <xrpl/protocol/AccountID.h>
#include <xrpl/protocol/Asset.h>
@@ -16,20 +17,111 @@
namespace xrpl {
class STTx;
/**
* Interest the vault's loans have earned since sfLastAccrualTime, capped by
* the sfUnearnedInterest budget still left to recognize.
*
* sfAssetsTotal is only credited when a loan event settles the vault, so
* between those events it lags by this amount. Adding it back at read time
* recognizes interest continuously as it is earned, without writing to
* sfAssetsTotal outside the loan transactions.
*
* Returns zero when nothing is accruing — no rate, no budget left, or a vault
* created before featureLendingProtocolV1_1.
*/
[[nodiscard]] Number
vaultAccruedInterest(ReadView const& view, SLE::const_ref vault);
/**
* Whether a rolling vault is inside a dealing window at this close time.
*
* A rolling vault deals in [SubscriptionDate + k * DealingInterval,
* SubscriptionDate + k * DealingInterval + DealingWindow) for integer k >= 0.
* Returns true for any vault that is not rolling, which has no windows to be
* outside of, and false before the first window opens.
*/
[[nodiscard]] bool
inDealingWindow(ReadView const& view, SLE::const_ref vault);
/**
* End of the dealing window containing this close time.
*
* Only meaningful when inDealingWindow is true for a rolling vault; it is the
* sfStruckUntil written when a window's price is struck.
*/
[[nodiscard]] std::uint32_t
dealingWindowEnd(ReadView const& view, SLE::const_ref vault);
/**
* The price every deal in the current window converts at, in vault asset per
* share, or nullopt when no struck price governs this ledger.
*
* Returns a price only for a rolling vault inside a window whose sfStruckUntil
* matches that window's end. Accrual continues underneath it: the dealing price
* is frozen for the window, the accounting is not.
*/
/**
* The interest recognition method of a vault.
*
* Returns sfAccountingMethod where it is present. A vault created before
* featureVaultContinuousAccrual carries no such field, so the method is derived
* from its schema version instead: CashBasis recognizes interest as it is
* collected, and anything older is Legacy, which recognizes a loan's whole-life
* interest at origination. Every vault that exists today therefore resolves
* without being touched.
*/
[[nodiscard]] std::uint8_t
getAccountingMethod(SLE::const_ref vault);
[[nodiscard]] std::optional<Number>
struckPriceInForce(ReadView const& view, SLE::const_ref vault);
/**
* Strike the price for the current window if it has not been struck yet.
*
* Called by the first deposit or withdrawal of a window. Does nothing for a
* vault that is not rolling, outside a window, or where this window's price is
* already struck, so it is safe to call unconditionally.
*/
void
strikeWindowPrice(ApplyView& view, SLE::ref vault, SLE::const_ref issuance);
/**
* Credit interest earned since the last settlement into sfAssetsTotal, draw
* it out of the sfUnearnedInterest budget, and stamp the current close time.
*
* Must be called before adjusting sfAccrualRate, so the elapsed period is
* charged at the rate that was in effect over it. Only the ttLOAN_*
* transactions may call this: ValidVault requires sfAssetsTotal to move with
* the vault balance on deposit and withdraw, which settling would violate.
* Pricing does not need it — the conversion helpers add elapsed interest
* themselves.
*/
void
accrueVault(ApplyView& view, SLE::ref vault);
/**
* From the perspective of a vault, return the number of shares to give
* depositor when they offer a fixed amount of assets. Note, since shares are
* MPT, this number is integral and always truncated in this calculation.
*
* @param vault The vault SLE.
* @param issuance The MPTokenIssuance SLE for the vault's shares.
* @param assets The amount of assets to convert.
*
* @return The number of shares, or nullopt on error.
* /**
* * From the perspective of a vault, return the number of shares to give
* * depositor when they offer a fixed amount of assets. Note, since shares are
* * MPT, this number is integral and always truncated in this calculation.
* *
* * @param vault The vault SLE.
* * @param issuance The MPTokenIssuance SLE for the vault's shares.
* * @param assets The amount of assets to convert.
* *
* * @return The number of shares, or nullopt on error.
*/
[[nodiscard]] std::optional<STAmount>
assetsToSharesDeposit(SLE::const_ref vault, SLE::const_ref issuance, STAmount const& assets);
assetsToSharesDeposit(
ReadView const& view,
SLE::const_ref vault,
SLE::const_ref issuance,
STAmount const& assets);
/**
* From the perspective of a vault, return the number of assets to take from
@@ -43,7 +135,11 @@ assetsToSharesDeposit(SLE::const_ref vault, SLE::const_ref issuance, STAmount co
* @return The number of assets, or nullopt on error.
*/
[[nodiscard]] std::optional<STAmount>
sharesToAssetsDeposit(SLE::const_ref vault, SLE::const_ref issuance, STAmount const& shares);
sharesToAssetsDeposit(
ReadView const& view,
SLE::const_ref vault,
SLE::const_ref issuance,
STAmount const& shares);
/**
* Adjusts a requested asset change (`delta`) to match the decimal scale of the
@@ -91,11 +187,12 @@ enum class WaiveUnrealizedLoss : bool { No = false, Yes = true };
* unrealized loss is waived. Used by assetsToSharesWithdraw and
* sharesToAssetsWithdraw as the numerator of the share/asset exchange rate.
*
* @param view The ledger view, for interest accrued since the last settlement.
* @param vault The vault SLE.
* @param waive Whether to skip subtracting the unrealized loss.
*/
[[nodiscard]] Number
assetsTotalForWithdrawal(SLE::const_ref vault, WaiveUnrealizedLoss waive);
assetsTotalForWithdrawal(ReadView const& view, SLE::const_ref vault, WaiveUnrealizedLoss waive);
/**
* Returns true if debiting `amount` from `total` (the current value of a
@@ -131,6 +228,7 @@ debitIsNonZeroDust(Asset const& asset, Number const& total, Number const& amount
*/
[[nodiscard]] std::optional<STAmount>
assetsToSharesWithdraw(
ReadView const& view,
SLE::const_ref vault,
SLE::const_ref issuance,
STAmount const& assets,
@@ -152,6 +250,7 @@ assetsToSharesWithdraw(
*/
[[nodiscard]] std::optional<STAmount>
sharesToAssetsWithdraw(
ReadView const& view,
SLE::const_ref vault,
SLE::const_ref issuance,
STAmount const& shares,

View File

@@ -29,6 +29,78 @@ constexpr std::uint32_t kAuctionSlotIntervalDuration =
constexpr std::uint16_t kVoteMaxSlots = 8;
constexpr std::uint32_t kVoteWeightScaleFactor = 100000;
// Curve type identifiers
enum CurveType : std::uint8_t {
CtConstantProduct = 0,
CtConcentratedLiquidity = 1,
CtStableSwap = 2,
CtBinned = 3,
};
inline constexpr CurveType protocolCurveTypes[] = {
CtConstantProduct,
CtConcentratedLiquidity,
CtStableSwap,
CtBinned,
};
// Fee tier definitions for concentrated liquidity
enum FeeTier : std::uint8_t {
FtStable = 0, // 1 bp, tick spacing 1
FtLow = 1, // 5 bp, tick spacing 10
FtMedium = 2, // 30 bp, tick spacing 60
FtHigh = 3, // 100 bp, tick spacing 200
};
inline constexpr std::uint16_t feeTierToFee[] = {1, 5, 30, 100};
inline constexpr std::int32_t feeTierToTickSpacing[] = {1, 10, 60, 200};
inline constexpr std::uint8_t feeTierCount = 4;
// Tick bounds
inline constexpr std::int32_t minTick = -887272;
inline constexpr std::int32_t maxTick = 887272;
// Offset-binary scaling applied wherever a tick is hashed or bit-packed
// to keep arithmetic in unsigned domain (avoids signed-division surprises
// near zero). Used by:
// - keylet::ammTick (offset-encoded into the low 64 keylet bits)
// - keylet::ammTickBitmapWord (wordIndex = (tick + offset) >> 8)
// - Validthe AMM bitmap-consistency invariant
// One constant, one source of fragility — DO NOT duplicate inline.
inline constexpr std::uint32_t kTickBitmapOffset =
static_cast<std::uint32_t>(-static_cast<std::int64_t>(minTick));
// StableSwap limits
inline constexpr std::uint32_t minAmplification = 1;
inline constexpr std::uint32_t maxAmplification = 5000;
inline constexpr std::uint32_t maxAmpChangePct = 10;
inline constexpr std::uint32_t ampRampDuration = 86400;
// Binned-curve limits. Bin step in basis points; bin price grows as
// (1 + binStep/10000)^binID. Range bound keeps state size finite and
// price range close to v3's effective range at default tick spacing.
inline constexpr std::int32_t minBinID = -221818;
inline constexpr std::int32_t maxBinID = 221818;
inline constexpr std::uint16_t validBinSteps[] = {1, 5, 10, 25, 100};
inline constexpr std::uint8_t binStepCount = 5;
// Newton's method convergence
inline constexpr int newtonMaxIterations = 256;
// Concentrated-liquidity per-swap tick-crossing cap. Bounds the
// per-swap work done by the curve's iterative tick traversal (each
// crossing does one SHAMap lookup for the next initialised tick + one
// SLE read). With FtStable's tickSpacing=1, 1000 crossings = ~10%
// price range; with FtMedium's tickSpacing=60, 1000 crossings spans
// the equivalent of a ~4x price move — both comfortably larger than
// any reasonable swap requires. Hitting the cap produces a silent
// partial fill: the curve returns the output realized over the first
// `maxTickCrossings` boundaries, and the caller infers the cap from
// the (smaller-than-requested) result. Uniswap v3 has no protocol
// cap (only block gas); we cap here because XRPL has no metered
// execution and the cap is the only fairness bound on per-swap work.
inline constexpr int maxTickCrossings = 1000;
class STObject;
class STAmount;
class Rules;
@@ -37,13 +109,20 @@ class Rules;
* Calculate Liquidity Provider Token (LPT) Currency.
*/
Currency
ammLPTCurrency(Asset const& asset1, Asset const& asset2);
ammLPTCurrency(
Asset const& asset1,
Asset const& asset2,
std::uint8_t curveType = CtConstantProduct);
/**
* Calculate LPT Issue from AMM asset pair.
*/
Issue
ammLPTIssue(Asset const& asset1, Asset const& asset2, AccountID const& ammAccountID);
ammLPTIssue(
Asset const& asset1,
Asset const& asset2,
AccountID const& ammAccountID,
std::uint8_t curveType = CtConstantProduct);
/**
* Validate the amount.

View File

@@ -16,6 +16,7 @@
#include <cstdint>
#include <limits>
#include <optional>
#include <vector>
namespace xrpl {
@@ -433,4 +434,88 @@ verifyConvertBackProof(
uint64_t amount,
uint256 const& contextHash);
/**
* @brief Generates the context hash for a BallotCastVote transaction.
*
* Binds the cast's range proof to this specific transaction, preventing
* proof reuse across ballots or accounts.
*
* @param account The voter's account ID.
* @param ballotID The target ballot's ledger index.
* @param sequence The transaction sequence number or ticket number.
* @return A 256-bit context hash unique to this cast.
*/
uint256
getBallotCastContextHash(AccountID const& account, uint256 const& ballotID, std::uint32_t sequence);
/**
* @brief Generates the context hash for a BallotFinalize transaction.
*
* Binds each per-option decryption-correctness proof to this specific
* finalize transaction.
*
* @param account The tally authority's account ID.
* @param ballotID The target ballot's ledger index.
* @param sequence The transaction sequence number or ticket number.
* @return A 256-bit context hash unique to this finalize.
*/
uint256
getBallotFinalizeContextHash(
AccountID const& account,
uint256 const& ballotID,
std::uint32_t sequence);
/**
* @brief Verifies an aggregated Bulletproof range proof over ballot option
* commitments.
*
* Proves that every one of the N per-option values committed in
* @p commitments lies in the non-negative range, so a vote cannot subtract
* weight from a disliked option. Thin wrapper over
* mpt_verify_aggregated_bulletproof.
*
* @param proof The serialized aggregated Bulletproof.
* @param commitments One 33-byte Pedersen commitment per option.
* @param contextHash The 256-bit context hash binding the proof.
* @return tesSUCCESS if the proof is valid, or an error code otherwise.
*/
TER
verifyBallotRangeProof(
Slice const& proof,
std::vector<Slice> const& commitments,
uint256 const& contextHash);
/**
* @brief Verifies the ciphertext-commitment linkage for one ballot option.
*
* Proves that the option's ElGamal ciphertext(s) encrypt the same value that
* its Pedersen commitment commits to, and that every mirror ciphertext (tally,
* optional auditor, optional voter) encrypts that same value under shared
* randomness. Combined with the aggregated range proof over the commitment,
* this pins the tally update to a non-negative value the voter cannot forge —
* the verifiable-encryption guarantee a vote needs because it encrypts under
* the tally key, which the voter does not own.
*
* Wraps secp256k1_compact_standard_verify. The balance-linkage terms of that
* relation are neutralized with a canonical witness (sk_A = 1, rho_b = 1), so
* pk_A = G, PC_b = H and B1 = B2 = G are reconstructed identically here and by
* the prover, and only the 192-byte proof is carried on the wire.
*
* @param pubKeys The n mirror public keys, tally key first (33 bytes each).
* @param c1 The shared ElGamal C1 component (33 bytes).
* @param c2PerKey The n ElGamal C2 components, one per mirror key (33 bytes).
* @param commitment The option's Pedersen commitment PC_m (33 bytes).
* @param proof The 192-byte compact sigma linkage proof.
* @param contextHash The 256-bit context hash binding the proof.
* @return tesSUCCESS if the linkage holds, or an error code otherwise.
*/
TER
verifyBallotVoteLinkage(
std::vector<Slice> const& pubKeys,
Slice const& c1,
std::vector<Slice> const& c2PerKey,
Slice const& commitment,
Slice const& proof,
uint256 const& contextHash);
} // namespace xrpl

View File

@@ -0,0 +1,17 @@
#pragma once
#include <xrpl/protocol/TxFormats.h>
#include <xrpl/protocol/TxSettings.h>
namespace xrpl {
/**
* How an account's firewall treats a transaction of the given type.
*
* The classification is declared per transaction in transactions.macro. A type
* the switch does not name, which means a deprecated one, is allowed.
*/
[[nodiscard]] FirewallAction
firewallAction(TxType txType) noexcept;
} // namespace xrpl

View File

@@ -15,13 +15,43 @@
#include <xrpl/protocol/SeqProxy.h>
#include <xrpl/protocol/UintTypes.h>
#include <boost/endian/conversion.hpp>
#include <array>
#include <cstdint>
#include <cstring>
#include <functional>
#include <set>
#include <utility>
namespace xrpl {
class SeqProxy;
// Structured-key helpers: read/write the low 64 bits of a uint256 keylet
// in big-endian byte order. Used by every AMM keylet scheme that
// embeds an ordered subkey (tick index, bitmap-word index, bin ID) into
// the low 64 bits so SHAMap range walks visit entries in subkey order.
//
// We type-pun via std::memcpy rather than a reinterpret_cast through
// uint64_t* — the latter violates strict aliasing and has no alignment
// guarantee on base_uint's underlying byte storage. memcpy of an
// 8-byte value compiles to a single load/store on x86_64 / ARM64 under
// any optimization level, so the safer idiom is free at runtime.
inline void
setLow64BE(uint256& key, std::uint64_t value) noexcept
{
auto const be = boost::endian::native_to_big(value);
std::memcpy(key.end() - sizeof(std::uint64_t), &be, sizeof(std::uint64_t));
}
[[nodiscard]] inline std::uint64_t
getLow64BE(uint256 const& key) noexcept
{
std::uint64_t be;
std::memcpy(&be, key.end() - sizeof(std::uint64_t), sizeof(std::uint64_t));
return boost::endian::big_to_native(be);
}
/**
* Keylet computation functions.
*
@@ -106,7 +136,9 @@ book(Book const& b);
* BTC, and Bob trusts Alice for BTC, here is only a single BTC trust line
* between them.
*/
/** @{ */
/**
* @{.
*/
Keylet
trustLine(AccountID const& id0, AccountID const& id1, Currency const& currency) noexcept;
@@ -115,12 +147,16 @@ trustLine(AccountID const& id, Issue const& issue) noexcept
{
return trustLine(id, issue.account, issue.currency);
}
/** @} */
/**
* @}.
*/
/**
* An offer from an account
*/
/** @{ */
/**
* @{.
*/
Keylet
offer(AccountID const& id, SeqProxy const& seq) noexcept;
@@ -129,7 +165,9 @@ offer(uint256 const& key) noexcept
{
return {ltOFFER, key};
}
/** @} */
/**
* @}.
*/
/**
* The initial directory page for a specific quality
@@ -146,7 +184,9 @@ next(Keylet const& k);
/**
* A ticket belonging to an account
*/
/** @{ */
/**
* @{.
*/
Keylet
ticket(AccountID const& id, SeqProxy const& ticketSeq);
@@ -155,7 +195,9 @@ ticket(uint256 const& key)
{
return {ltTICKET, key};
}
/** @} */
/**
* @}.
*/
/**
* A SignerList
@@ -169,10 +211,18 @@ signerList(AccountID const& account) noexcept;
Keylet
sponsorship(AccountID const& sponsor, AccountID const& sponsee) noexcept;
/**
* An account's beneficiary designation. One per account.
*/
Keylet
beneficiary(AccountID const& account) noexcept;
/**
* A Check
*/
/** @{ */
/**
* @{.
*/
Keylet
check(AccountID const& id, SeqProxy const& seq) noexcept;
@@ -181,12 +231,16 @@ check(uint256 const& key) noexcept
{
return {ltCHECK, key};
}
/** @} */
/**
* @}.
*/
/**
* A DepositPreauth
*/
/** @{ */
/**
* @{.
*/
Keylet
depositPreauth(AccountID const& owner, AccountID const& preauthorized) noexcept;
@@ -200,7 +254,9 @@ depositPreauth(uint256 const& key) noexcept
{
return {ltDEPOSIT_PREAUTH, key};
}
/** @} */
/**
* @}.
*/
//------------------------------------------------------------------------------
@@ -219,7 +275,9 @@ ownerDir(AccountID const& id) noexcept;
/**
* A page in a directory
*/
/** @{ */
/**
* @{.
*/
Keylet
page(uint256 const& root, std::uint64_t const index = 0) noexcept;
@@ -229,7 +287,9 @@ page(Keylet const& root, std::uint64_t const index = 0) noexcept
XRPL_ASSERT(root.type == ltDIR_NODE, "xrpl::keylet::page : valid root type");
return page(root.key, index);
}
/** @} */
/**
* @}.
*/
/**
* An escrow entry
@@ -251,7 +311,9 @@ payChannel(AccountID const& src, AccountID const& dst, SeqProxy const& seq) noex
* 160-bit AccountID, followed by a 96-bit value that determines which NFT
* tokens are candidates for that page.
*/
/** @{ */
/**
* @{.
*/
/**
* A keylet for the owner's first possible NFT page.
*/
@@ -266,7 +328,9 @@ nftokenPageMax(AccountID const& owner);
Keylet
nftokenPage(Keylet const& k, uint256 const& token);
/** @} */
/**
* @}.
*/
/**
* An offer from an account to buy or sell an NFT
@@ -296,7 +360,7 @@ nftSells(uint256 const& id) noexcept;
* AMM entry
*/
Keylet
amm(Asset const& issue1, Asset const& issue2) noexcept;
amm(Asset const& issue1, Asset const& issue2, std::uint8_t curveType = 0) noexcept;
Keylet
amm(uint256 const& amm) noexcept;
@@ -342,6 +406,15 @@ mptokenIssuance(uint256 const& issuanceKey)
return {ltMPTOKEN_ISSUANCE, issuanceKey};
}
Keylet
tokenIssuance(AccountID const& issuer, Currency const& currency) noexcept;
inline Keylet
tokenIssuance(uint256 const& key)
{
return {ltTOKEN_ISSUANCE, key};
}
Keylet
mptoken(MPTID const& issuanceID, AccountID const& holder) noexcept;
@@ -366,6 +439,45 @@ vault(uint256 const& vaultKey)
Keylet
loanBroker(AccountID const& owner, SeqProxy const& seq) noexcept;
/**
* A repurchase agreement, keyed by the seller and the creating sequence.
*/
Keylet
repo(AccountID const& seller, SeqProxy const& seq) noexcept;
inline Keylet
repo(uint256 const& repoID)
{
return {ltREPO, repoID};
}
/**
* A firewall, keyed by the account it protects.
*/
Keylet
firewall(AccountID const& account) noexcept;
inline Keylet
firewall(uint256 const& firewallID)
{
return {ltFIREWALL, firewallID};
}
/**
* A withdraw preauthorization, keyed by owner, authorized account and tag.
*/
Keylet
withdrawPreauth(
AccountID const& owner,
AccountID const& preauthorized,
std::uint32_t dtag) noexcept;
inline Keylet
withdrawPreauth(uint256 const& key)
{
return {ltWITHDRAW_PREAUTH, key};
}
inline Keylet
loanBroker(uint256 const& key)
{
@@ -381,11 +493,161 @@ loan(uint256 const& key)
return {ltLOAN, key};
}
Keylet
couponSchedule(uint192 const& mptIssuanceID) noexcept;
inline Keylet
couponSchedule(uint256 const& scheduleKey)
{
return {ltCOUPON_SCHEDULE, scheduleKey};
}
Keylet
permissionedDomain(AccountID const& account, SeqProxy const& seq) noexcept;
Keylet
permissionedDomain(uint256 const& domainID) noexcept;
/**
* A concentrated liquidity AMM position.
*/
Keylet
ammPosition(uint256 const& ammID, AccountID const& owner, std::uint32_t seq) noexcept;
inline Keylet
ammPosition(uint256 const& key)
{
return {ltAMM_POSITION, key};
}
/**
* A concentrated liquidity AMM tick.
* Uses structured (non-hashed) keys for ordered SHAMap traversal.
* High 192 bits: pool scope (from ammID hash).
* Low 64 bits: encoded tick index (offset binary, big-endian).
*/
Keylet
ammTick(uint256 const& ammID, std::int32_t tickIndex) noexcept;
inline Keylet
ammTick(uint256 const& key)
{
return {ltAMM_TICK, key};
}
/**
* Base key for a CL pool's tick range (low 64 bits zeroed).
*/
Keylet
ammTickBase(uint256 const& ammID) noexcept;
/**
* End key for a CL pool's tick range (low 64 bits all 1s).
*/
Keylet
ammTickEnd(uint256 const& ammID) noexcept;
/**
* A 256-tick presence bitmap window for a CL pool.
* Keylet structure mirrors `ammTick`: high 192 bits derive from a pool-scoped
* hash, low 64 bits encode the word index (big-endian) so range walks via
* SHAMap succ/pred yield the next-higher / next-lower word.
*/
Keylet
ammTickBitmapWord(uint256 const& ammID, std::uint16_t wordIndex) noexcept;
inline Keylet
ammTickBitmapWord(uint256 const& key)
{
return {ltAMM_TICK_BITMAP, key};
}
/**
* Base key for a CL pool's tick-bitmap range (low 64 bits zeroed).
*/
Keylet
ammTickBitmapBase(uint256 const& ammID) noexcept;
/**
* End key for a CL pool's tick-bitmap range (low 64 bits all 1s).
*/
Keylet
ammTickBitmapEnd(uint256 const& ammID) noexcept;
/**
* A single bin within a CtBinned AMM pool. Bins are keyed by signed
* bin ID, offset-encoded into the low 64 bits of the keylet so SHAMap
* range walks yield consecutive bins in price order.
*/
Keylet
ammBin(uint256 const& ammID, std::int32_t binID) noexcept;
/**
* Lookup a bin SLE by its raw key (used by transactors that have a
* stored issuance / bin reference).
*/
Keylet
ammBin(uint256 const& key) noexcept;
/**
* Base / end keys for a binned AMM's bin-SLE range. Bins for the
* same AMM are contiguous in SHAMap order (high 192 bits are an
* ammID-scoped hash; low 64 bits offset-encode the bin ID), so
* `view.succ(bin_at(binID).key, ammBinEnd(ammID).key)` jumps to the
* next populated bin in O(log n) regardless of gap size.
*/
Keylet
ammBinBase(uint256 const& ammID) noexcept;
Keylet
ammBinEnd(uint256 const& ammID) noexcept;
/**
* A single LP's holding record in a single bin. Phase 5 will replace
* this with a fungible MPT issuance per bin.
*/
Keylet
ammBinHolding(uint256 const& ammID, AccountID const& owner, std::int32_t binID) noexcept;
Keylet
ammBinHolding(uint256 const& key) noexcept;
/**
* A ballot owned by `owner`, keyed by the creating transaction sequence.
*/
Keylet
ballot(AccountID const& owner, std::uint32_t seq) noexcept;
inline Keylet
ballot(uint256 const& ballotID)
{
return {ltBALLOT, ballotID};
}
/**
* A voter's cast on the ballot identified by `ballotID`.
*/
Keylet
ballotVote(uint256 const& ballotID, AccountID const& voter) noexcept;
inline Keylet
ballotVote(uint256 const& key)
{
return {ltBALLOT_VOTE, key};
}
Keylet
passkeyList(AccountID const& account) noexcept;
Keylet
subscription(AccountID const& account, AccountID const& dest, std::uint32_t seq) noexcept;
inline Keylet
subscription(uint256 const& key) noexcept
{
return {ltSUBSCRIPTION, key};
}
} // namespace keylet
// Everything below is deprecated and should be removed in favor of keylets:

View File

@@ -8,6 +8,8 @@ namespace xrpl {
enum class KeyType {
Secp256k1 = 0,
Ed25519 = 1,
Dilithium = 2,
P256 = 3,
};
inline std::optional<KeyType>
@@ -19,6 +21,12 @@ keyTypeFromString(std::string const& s)
if (s == "ed25519")
return KeyType::Ed25519;
if (s == "dilithium")
return KeyType::Dilithium;
if (s == "p256")
return KeyType::P256;
return {};
}
@@ -31,6 +39,12 @@ to_string(KeyType type)
if (type == KeyType::Ed25519)
return "ed25519";
if (type == KeyType::Dilithium)
return "dilithium";
if (type == KeyType::P256)
return "p256";
return "INVALID";
}

View File

@@ -154,7 +154,8 @@ enum LedgerEntryType : std::uint16_t {
LEDGER_OBJECT(Offer, \
LSF_FLAG(lsfPassive, 0x00010000) \
LSF_FLAG(lsfSell, 0x00020000) /* True, offer was placed as a sell. */ \
LSF_FLAG(lsfHybrid, 0x00040000)) /* True, offer is hybrid. */ \
LSF_FLAG(lsfHybrid, 0x00040000) /* True, offer is hybrid. */ \
LSF_FLAG(lsfAllOrNone, 0x00080000)) /* True, offer is all-or-none. */ \
\
LEDGER_OBJECT(RippleState, \
LSF_FLAG(lsfLowReserve, 0x00010000) /* True, if entry counts toward reserve. */ \
@@ -188,7 +189,8 @@ enum LedgerEntryType : std::uint16_t {
LSF_FLAG(lsfMPTCanTrade, 0x00000010) \
LSF_FLAG(lsfMPTCanTransfer, 0x00000020) \
LSF_FLAG(lsfMPTCanClawback, 0x00000040) \
LSF_FLAG(lsfMPTCanHoldConfidentialBalance, 0x00000080)) \
LSF_FLAG(lsfMPTCanHoldConfidentialBalance, 0x00000080) \
LSF_FLAG(lsfMPTCouponSchedule, 0x00000100)) \
\
LEDGER_OBJECT(MPToken, \
LSF_FLAG2(lsfMPTLocked, 0x00000001) \
@@ -208,7 +210,20 @@ enum LedgerEntryType : std::uint16_t {
\
LEDGER_OBJECT(Sponsorship, \
LSF_FLAG(lsfSponsorshipRequireSignForFee, 0x00010000) \
LSF_FLAG(lsfSponsorshipRequireSignForReserve, 0x00020000))
LSF_FLAG(lsfSponsorshipRequireSignForReserve, 0x00020000)) \
\
LEDGER_OBJECT(Ballot, \
LSF_FLAG(lsfBallotFinalized, 0x00000001) /* True, results have been published */ \
LSF_FLAG(lsfVoterRecoverable, 0x00000002)) /* True, casts carry a voter self-recovery vector */ \
\
LEDGER_OBJECT(Subscription, \
LSF_FLAG(lsfSingleUse, 0x00010000)) /* True, delete on first successful claim */ \
\
LEDGER_OBJECT(TokenIssuance, \
LSF_FLAG(lsfTokenLocked, 0x00000001) /* True, per-currency global freeze */ \
LSF_FLAG(lsfTokenCannotLock, 0x00000002) /* True, issuer renounced the per-currency lock */ \
LSF_FLAG(lsfTokenWrapped, 0x00000004) /* True, owned by a pseudo-account (blackholed issuer) */ \
LSF_FLAG(lsfTokenVerifiedSupply, 0x00000008)) /* True, IssuedAmount reflects verified legacy supply */
// clang-format on

View File

@@ -2,11 +2,17 @@
#include <xrpl/basics/base_uint.h>
#include <xrpl/protocol/HashPrefix.h>
#include <xrpl/protocol/STAmount.h>
#include <xrpl/protocol/Serializer.h>
#include <xrpl/protocol/XRPAmount.h>
namespace xrpl {
/**
* Serialize the PaymentChannelClaim authorization message:
* HashPrefix::PaymentChannelClaim, the channel key and the drops as a
* 64-bit integer.
*/
inline void
serializePayChanAuthorization(Serializer& msg, uint256 const& key, XRPAmount const& amt)
{
@@ -15,4 +21,23 @@ serializePayChanAuthorization(Serializer& msg, uint256 const& key, XRPAmount con
msg.add64(amt.drops());
}
/**
* Serialize the PaymentChannelClaim authorization message for any asset: a
* native amount uses the XRP layout; a token amount follows
* HashPrefix::PaymentChannelClaim and the channel key with STAmount::add, the
* Amount field value without its field header.
*/
inline void
serializePayChanAuthorization(Serializer& msg, uint256 const& key, STAmount const& amt)
{
if (amt.native())
{
serializePayChanAuthorization(msg, key, amt.xrp());
return;
}
msg.add32(HashPrefix::PaymentChannelClaim);
msg.addBitString(key);
amt.add(msg);
}
} // namespace xrpl

View File

@@ -12,6 +12,7 @@
#include <chrono>
#include <cstddef>
#include <cstdint>
#include <limits>
namespace xrpl {
@@ -140,6 +141,13 @@ tenthBipsOfValue(T value, TenthBips<TBips> bips)
return value * bips.value() / kTenthBipsPerUnity.value();
}
/**
* The longest inactivity period a beneficiary designation may require, ten
* years in seconds. Long enough for the intended use and short enough that the
* value still means something.
*/
constexpr std::uint32_t kMaxBeneficiaryTimeLock = 10 * 365 * 24 * 60 * 60;
namespace lending {
/**
* The maximum management fee rate allowed by a loan broker in 1/10 bips.
@@ -301,11 +309,29 @@ static_assert(Number::kMaxRep >= kMaxMpTokenAmount);
*/
constexpr std::size_t kMaxDataPayloadLength = 256;
/**
* The maximum length of a structured-data Schema
*/
constexpr std::size_t kMaxSchemaLength = 256;
/**
* Vault withdrawal policies
*/
constexpr std::uint8_t kVaultStrategyFirstComeFirstServe = 1;
/**
* Vault interest recognition methods.
*
* Legacy recognizes a loan's whole-life interest at origination and is the
* implicit method for vaults created before featureLendingProtocolV1_1. Cash
* recognizes interest as it is collected; accrual recognizes it continuously
* as it is earned. Fixed at VaultCreate — changing it would reprice every
* outstanding share in a single step.
*/
constexpr std::uint8_t kVaultAccountingLegacy = 0;
constexpr std::uint8_t kVaultAccountingCash = 1;
constexpr std::uint8_t kVaultAccountingAccrual = 2;
/**
* Default IOU scale factor for a Vault
*/
@@ -315,7 +341,13 @@ constexpr std::uint8_t kVaultDefaultIouScale = 6;
* 1 IOU can be always converted to shares.
* 10^19 > maxMPTokenAmount (2^64-1) > 10^18
*/
constexpr std::uint8_t kVaultMaximumIouScale = 18;
constexpr std::uint8_t kVaultMaximumIouScale =
18; /** Largest deposit or redemption fee a vault may charge, in 1/10 bips.
Matches kMaxTransferFee: half of what is moved is the most any fee may
retain.
*/
constexpr std::uint32_t kMaxVaultFee = 50'000;
/**
* Vault ledger-entry schema versions. Assigned to newly created
@@ -329,12 +361,16 @@ enum class VaultVersion : uint8_t {
};
/**
* Vault kind. Distinguishes closed-ended vaults from the default open-ended
* kind. Persisted as sfVaultKind (UINT8); absent means OpenEnded.
* Vault kind. Distinguishes closed-ended and rolling vaults from the default
* open-ended kind. Persisted as sfVaultKind (UINT8); absent means OpenEnded.
*
* A rolling vault deals in a window that reopens every sfDealingInterval
* seconds and stays open for sfDealingWindow of them.
*/
enum class VaultKind : std::uint8_t {
OpenEnded = 0,
ClosedEnded = 1,
Rolling = 2,
};
/**
@@ -375,6 +411,20 @@ constexpr std::uint32_t kMaxInvestmentPeriod = std::chrono::seconds{std::chrono:
*/
constexpr std::uint8_t kMaxAssetCheckDepth = 5;
/**
* Maximum MaximumAmount of a TokenIssuance, in base units (10^15). Bounded
* to what Number/STAmount arithmetic represents exactly, so the supply-cap
* comparison can never be affected by mantissa rounding.
*/
constexpr std::uint64_t kMaxTokenIssuanceAmount = 1'000'000'000'000'000ull;
static_assert(kMaxTokenIssuanceAmount <= kMaxMpTokenAmount);
/**
* Maximum TokenScale of a TokenIssuance: 10^scale must stay in exact int64
* range. 10^19 > 2^63-1 > 10^18
*/
constexpr std::uint8_t kMaxTokenIssuanceScale = 18;
/**
* A ledger index.
*/
@@ -544,6 +594,11 @@ constexpr std::size_t kEcClawbackProofLength = SECP256K1_COMPACT_CLAWBACK_PROOF_
*/
constexpr std::uint32_t kConfidentialFeeMultiplier = 9;
/**
* Maximum value a confidential MPT key epoch may reach.
*/
constexpr std::uint32_t kMaxKeyEpoch = std::numeric_limits<std::uint32_t>::max();
/**
* Compressed EC point prefix for even y-coordinate
*/

View File

@@ -36,10 +36,12 @@ namespace xrpl {
* information needed to determine the cryptosystem
* parameters used is stored inside the key.
*
* As of this writing two systems are supported:
* As of this writing three systems are supported:
*
* secp256k1
* ed25519
* dilithium
* p256
*
* secp256k1 public keys consist of a 33 byte
* compressed public key, with the lead byte equal
@@ -48,14 +50,20 @@ namespace xrpl {
* The ed25519 public keys consist of a 1 byte
* prefix constant 0xED, followed by 32 bytes of
* public key data.
*
* The dilithium public keys will have their own specific format.
*/
class PublicKey
{
protected:
// All the constructed public keys are valid, non-empty and contain 33
// bytes of data.
// Minimum public key size (secp256k1, ed25519 hold 33 bytes;
// uncompressed p256 keys hold 65 bytes).
static constexpr std::size_t kSize = 33;
std::uint8_t buf_[kSize]{}; // should be large enough
// Buffer sized for the largest supported key (dilithium = 1312 bytes).
// Actual length is tracked in size_.
static constexpr std::size_t kMaxSize = 1312;
std::uint8_t buf_[kMaxSize]{};
std::size_t size_ = 0;
public:
using const_iterator = std::uint8_t const*;
@@ -81,10 +89,10 @@ public:
return buf_;
}
static std::size_t
size() noexcept
[[nodiscard]] std::size_t
size() const noexcept
{
return kSize;
return size_;
}
[[nodiscard]] const_iterator
@@ -102,19 +110,19 @@ public:
[[nodiscard]] const_iterator
end() const noexcept
{
return buf_ + kSize;
return buf_ + size_;
}
[[nodiscard]] const_iterator
cend() const noexcept
{
return buf_ + kSize;
return buf_ + size_;
}
[[nodiscard]] Slice
slice() const noexcept
{
return {buf_, kSize};
return {buf_, size_};
}
operator Slice() const noexcept
@@ -132,7 +140,7 @@ operator<<(std::ostream& os, PublicKey const& pk);
inline bool
operator==(PublicKey const& lhs, PublicKey const& rhs)
{
return std::memcmp(lhs.data(), rhs.data(), rhs.size()) == 0;
return lhs.size() == rhs.size() && std::memcmp(lhs.data(), rhs.data(), rhs.size()) == 0;
}
inline bool

View File

@@ -77,9 +77,27 @@ public:
void
associateAsset(Asset const& a) override;
// Reconstruct via the (mantissa, exponent) ctor so the returned
// Number is normalized to the *current* mantissa scale, not the
// scale that was active when value_ was last set.
//
// STNumber instances are held across transaction boundaries (in
// SLE-cache memory), and the mantissa scale flips per-tx based on
// featureSingleAssetVault / featureLendingProtocol (see
// setCurrentTransactionRules in Rules.cpp). A Number normalized at
// Large scale outside any tx context will fail isnormal() inside a
// Small-scale tx, tripping the assert in operator+=. mantissa() /
// exponent() return the canonical (scale-independent) external
// view; the Normalized{} ctor re-normalizes to current scale.
//
// This costs one extra normalize() per implicit conversion to
// Number — single-digit ns, well below the cost of any caller's
// arithmetic.
operator Number() const
{
return value_;
if (value_ == Number{})
return value_;
return Number{value_.mantissa(), value_.exponent()};
}
private:

View File

@@ -191,7 +191,13 @@ STValidation::STValidation(SerialIter& sit, LookupNodeID&& lookupNodeID, Deseria
, signingPubKey_([this]() {
auto const spk = getFieldVL(sfSigningPubKey);
if (publicKeyType(makeSlice(spk)) != KeyType::Secp256k1)
// Validations are signed with either the legacy secp256k1 key
// (pre-amendment) or the new dilithium key (post-amendment). Mixed
// sets are expected during the rolling upgrade. Ed25519 has never
// been valid for validations and is still rejected. verifyDigest()
// dispatches per keytype.
auto const kt = publicKeyType(makeSlice(spk));
if (kt != KeyType::Secp256k1 && kt != KeyType::Dilithium)
Throw<std::runtime_error>("Invalid public key in validation");
return PublicKey{makeSlice(spk)};
@@ -234,9 +240,11 @@ STValidation::STValidation(
"xrpl::STValidation::STValidation(PublicKey, SecretKey) : nonzero "
"node");
// First, set our own public key:
if (publicKeyType(pk) != KeyType::Secp256k1)
logicError("We can only use secp256k1 keys for signing validations");
// First, set our own public key. Only secp256k1 (legacy) and dilithium
// (post-quantum) are valid for signing validations; Ed25519 has never
// been supported here.
if (auto const kt = publicKeyType(pk); kt != KeyType::Secp256k1 && kt != KeyType::Dilithium)
logicError("Validation signing requires secp256k1 or dilithium key");
setFieldVL(sfSigningPubKey, pk.slice());
setFieldU32(sfSigningTime, signTime.time_since_epoch().count());

View File

@@ -23,10 +23,17 @@ namespace xrpl {
class SecretKey
{
public:
// ed25519 and secp256k1 secret keys are 32 bytes.
static constexpr std::size_t kSize = 32;
// Dilithium secret keys are 2560 bytes (FIPS 204 ML-DSA-44; the earlier
// round-3 draft was 2528). SecretKey.cpp asserts this against the
// library's CRYPTO_SECRETKEYBYTES.
static constexpr std::size_t kDilithiumSize = 2560;
private:
std::uint8_t buf_[kSize]{};
// Buffer sized for the largest supported key; actual length in size_.
std::uint8_t buf_[kDilithiumSize]{};
std::size_t size_ = 0;
public:
using const_iterator = std::uint8_t const*;
@@ -44,6 +51,7 @@ public:
~SecretKey();
SecretKey(std::array<std::uint8_t, kSize> const& data);
SecretKey(std::array<std::uint8_t, kDilithiumSize> const& data);
SecretKey(Slice const& slice);
[[nodiscard]] std::uint8_t const*
@@ -55,7 +63,7 @@ public:
[[nodiscard]] std::size_t
size() const
{
return sizeof(buf_);
return size_;
}
/**
@@ -82,13 +90,13 @@ public:
[[nodiscard]] const_iterator
end() const noexcept
{
return buf_ + sizeof(buf_);
return buf_ + size_;
}
[[nodiscard]] const_iterator
cend() const noexcept
{
return buf_ + sizeof(buf_);
return buf_ + size_;
}
};
@@ -119,6 +127,12 @@ toBase58(TokenType type, SecretKey const& sk)
SecretKey
randomSecretKey();
/**
* Create a secret key using secure random numbers.
*/
SecretKey
randomSecretKey(KeyType type);
/**
* Generate a new secret key deterministically.
*/

View File

@@ -0,0 +1,78 @@
#pragma once
#include <xrpl/basics/Slice.h>
#include <cstddef>
#include <cstdint>
namespace xrpl {
/**
* Structural validation for MPTStructuredData schemas and data.
*
* A schema is a sequence of one-byte type codes describing a packed
* record layout. Data is the corresponding values packed back-to-back
* in schema order: big-endian integers, VL-prefixed str/bin (standard
* XRPL variable-length encoding, byte counts), arrays as a one-byte
* element count followed by that many elements, and tuples with no
* framing of their own (the markers exist only in the schema).
*
* These functions validate structure only. No values are materialized
* and no semantic checks are performed beyond the bool 0x00/0x01 rule.
*/
/**
* Schema type codes. Codes not listed here are reserved and malformed.
*/
enum class SchemaType : std::uint8_t {
boolean = 0x01, // 1 byte, 0x00 or 0x01
u8 = 0x02, // 1 byte
u16 = 0x03, // 2 bytes, big-endian
u32 = 0x04, // 4 bytes, big-endian
u64 = 0x05, // 8 bytes, big-endian
u128 = 0x06, // 16 bytes
u256 = 0x07, // 32 bytes
xfl = 0x08, // 8 bytes, XLS-17 floating point
account = 0x09, // 20 bytes, AccountID
currency = 0x0A, // 20 bytes, 160-bit currency code
h160 = 0x0B, // 20 bytes
h256 = 0x0C, // 32 bytes
pubkey = 0x0D, // 33 bytes, compressed public key
str = 0x0E, // VL prefix + UTF-8 bytes
bin = 0x0F, // VL prefix + opaque bytes
array = 0x20, // followed by one element type; data: count byte + elements
tupleOpen = 0x30,
tupleClose = 0x31,
};
/**
* Maximum array/tuple nesting depth a schema may declare.
*/
constexpr std::size_t kMaxSchemaDepth = 8;
/**
* Check that a schema is well-formed.
*
* Well-formed means: non-empty, no longer than kMaxSchemaLength, every
* code is a known SchemaType, every array code is followed by an
* element type, every tupleOpen has a matching tupleClose, and nesting
* does not exceed kMaxSchemaDepth.
*/
[[nodiscard]] bool
isWellFormedSchema(Slice schema);
/**
* Check that data decodes exactly against a well-formed schema.
*
* Walks both inputs with two cursors. Every field must be present at
* its declared width (VL-prefixed for str/bin), array counts must be
* consistent with the remaining input, and both cursors must end
* exactly exhausted: truncated data and trailing bytes both fail.
*
* The schema is re-validated during the walk, so a malformed schema
* returns false rather than misreading data.
*/
[[nodiscard]] bool
dataMatchesSchema(Slice schema, Slice data);
} // namespace xrpl

View File

@@ -129,8 +129,11 @@ enum TEMcodes : TERUnderlyingType {
temARRAY_TOO_LARGE,
temBAD_TRANSFER_FEE,
temINVALID_INNER_BATCH,
temBAD_MPT,
temBAD_CIPHERTEXT,
temINVALID_BYTECODE,
temTEMP_DISABLED,
};
//------------------------------------------------------------------------------
@@ -179,6 +182,9 @@ enum TEFcodes : TERUnderlyingType {
tefINVALID_LEDGER_FIX_TYPE,
tefNO_DST_PARTIAL,
tefBAD_PATH_COUNT,
tefNO_BYTECODE,
tefBYTECODE_NOT_INCLUDED,
tefFIREWALL_BLOCK,
};
//------------------------------------------------------------------------------
@@ -370,6 +376,24 @@ enum TECcodes : TERUnderlyingType {
tecNO_DELEGATE_PERMISSION = 198,
tecBAD_PROOF = 199,
tecNO_SPONSOR_PERMISSION = 200,
tecOUT_OF_GAS = 201,
tecBYTECODE_REJECTED = 202,
tecWOULD_CROSS = 203,
tecBALLOT_CLOSED = 205,
tecBALLOT_VOTED = 206,
tecBALLOT_NOT_OPEN = 207,
tecBALLOT_EXISTS = 208,
tecBALLOT_BAD_OPTIONS = 209,
// Audit #20: surfaced when a CL swap loop exhausts the per-call
// maxTickCrossings budget. POST-AUDIT-#19: BookStep now iterates per
// tick range and never crosses >1000 ticks in one applySwap call, so
// this code is not reachable through normal Payment routing. It
// remains the contract for direct curve callers and as a safety net
// for any future code path that bypasses #19's iteration model.
tecAMM_TICK_CAP_HIT = 210,
tecREPO_ACTIVE = 211,
tecREPO_PENDING = 212,
tecSUPPLY_EXCEEDED = 213,
};
//------------------------------------------------------------------------------

View File

@@ -97,7 +97,9 @@ inline constexpr FlagValue tfUniversalMask = ~tfUniversal;
TF_FLAG(tfImmediateOrCancel, 0x00020000) \
TF_FLAG(tfFillOrKill, 0x00040000) \
TF_FLAG(tfSell, 0x00080000) \
TF_FLAG(tfHybrid, 0x00100000), \
TF_FLAG(tfHybrid, 0x00100000) \
TF_FLAG(tfAllOrNone, 0x00200000) \
TF_FLAG(tfPostOnly, 0x00400000), \
MASK_ADJ(0)) \
\
TRANSACTION(Payment, \
@@ -162,6 +164,16 @@ inline constexpr FlagValue tfUniversalMask = ~tfUniversal;
TF_FLAG(tfMPTSetCanHoldConfidentialBalance, 0x00000100), \
MASK_ADJ(0)) \
\
TRANSACTION(TokenIssuanceCreate, \
TF_FLAG(tfTokenCannotLock, 0x00000001), \
MASK_ADJ(0)) \
\
TRANSACTION(TokenIssuanceSet, \
TF_FLAG2(tfTokenCannotLock, 0x00000001) \
TF_FLAG(tfTokenLock, 0x00000002) \
TF_FLAG(tfTokenUnlock, 0x00000004), \
MASK_ADJ(0)) \
\
TRANSACTION(NFTokenCreateOffer, \
TF_FLAG(tfSellNFToken, 0x00000001), \
MASK_ADJ(0)) \
@@ -238,6 +250,14 @@ inline constexpr FlagValue tfUniversalMask = ~tfUniversal;
TF_FLAG(tfSponsorshipEnd, 0x00010000) \
TF_FLAG(tfSponsorshipCreate, 0x00020000) \
TF_FLAG(tfSponsorshipReassign, 0x00040000), \
MASK_ADJ(0)) \
\
TRANSACTION(BallotCreate, \
TF_FLAG(tfVoterRecoverable, lsfVoterRecoverable), /* casts must carry a voter self-recovery vector */ \
MASK_ADJ(0)) \
\
TRANSACTION(SubscriptionSet, /* True, delete the subscription on the first successful claim */ \
TF_FLAG(tfSingleUse, 0x00010000), \
MASK_ADJ(0))
// clang-format on

View File

@@ -10,6 +10,27 @@ namespace xrpl {
enum class Delegation { Delegable, NotDelegable };
/**
* How an account's firewall treats a transaction the account submits.
*
* The classification is per transaction type and is read through
* firewallAction() in <xrpl/protocol/Firewall.h>.
*/
enum class FirewallAction {
/**
* The firewall inspects the transaction's destination before applying it.
*/
Check,
/**
* The firewall lets the transaction through without inspecting it.
*/
Allow,
/**
* The firewall rejects the transaction while a firewall is set.
*/
Block
};
/**
* Operations a transaction is permitted to perform, as a bitfield.
*
@@ -17,25 +38,27 @@ enum class Delegation { Delegable, NotDelegable };
* TxSettings::privileges) and enforced in InvariantCheck.cpp.
*/
enum class Privilege : std::uint16_t {
NoPriv = 0x0000, // The transaction can not do any of the enumerated operations
CreateAcct = 0x0001, // The transaction can create a new ACCOUNT_ROOT object.
CreatePseudoAcct = 0x0002, // The transaction can create a pseudo account,
// which implies createAcct
MustDeleteAcct = 0x0004, // The transaction must delete an ACCOUNT_ROOT object
MayDeleteAcct = 0x0008, // The transaction may delete an ACCOUNT_ROOT
// object, but does not have to
OverrideFreeze = 0x0010, // The transaction can override some freeze rules
ChangeNftCounts = 0x0020, // The transaction can mint or burn an NFT
CreateMptIssuance = 0x0040, // The transaction can create a new MPT issuance
DestroyMptIssuance = 0x0080, // The transaction can destroy an MPT issuance
MustAuthorizeMpt = 0x0100, // The transaction MUST create or delete an MPT
// object (except by issuer)
MayAuthorizeMpt = 0x0200, // The transaction MAY create or delete an MPT
// object (except by issuer)
MayDeleteMpt = 0x0400, // The transaction MAY delete an MPT object. May not create.
MustModifyVault = 0x0800, // The transaction must modify, delete or create, a vault
MayModifyVault = 0x1000, // The transaction MAY modify, delete or create, a vault
MayCreateMpt = 0x2000, // The transaction MAY create an MPT object, except for issuer.
NoPriv = 0x0000, // The transaction can not do any of the enumerated operations
CreateAcct = 0x0001, // The transaction can create a new ACCOUNT_ROOT object.
CreatePseudoAcct = 0x0002, // The transaction can create a pseudo account,
// which implies createAcct
MustDeleteAcct = 0x0004, // The transaction must delete an ACCOUNT_ROOT object
MayDeleteAcct = 0x0008, // The transaction may delete an ACCOUNT_ROOT
// object, but does not have to
OverrideFreeze = 0x0010, // The transaction can override some freeze rules
ChangeNftCounts = 0x0020, // The transaction can mint or burn an NFT
CreateMptIssuance = 0x0040, // The transaction can create a new MPT issuance
DestroyMptIssuance = 0x0080, // The transaction can destroy an MPT issuance
MustAuthorizeMpt = 0x0100, // The transaction MUST create or delete an MPT
// object (except by issuer)
MayAuthorizeMpt = 0x0200, // The transaction MAY create or delete an MPT
// object (except by issuer)
MayDeleteMpt = 0x0400, // The transaction MAY delete an MPT object. May not create.
MustModifyVault = 0x0800, // The transaction must modify, delete or create, a vault
MayModifyVault = 0x1000, // The transaction MAY modify, delete or create, a vault
MayCreateMpt = 0x2000, // The transaction MAY create an MPT object, except for issuer.
CreateTokenIssuance = 0x4000, // The transaction can create a new token issuance
DestroyTokenIssuance = 0x8000, // The transaction can destroy a token issuance
};
// The inner static_cast is not redundant: the underlying type is narrower than
@@ -91,6 +114,11 @@ struct TxSettings
* Operations this transaction is permitted to perform.
*/
Privilege privileges{Privilege::NoPriv};
/**
* How an account's firewall treats this transaction.
*/
FirewallAction firewall{FirewallAction::Allow};
};
} // namespace xrpl

View File

@@ -15,6 +15,7 @@
// Add new amendments to the top of this list.
// Keep it sorted in reverse chronological order.
XRPL_FIX (BatchV1_2, Supported::Yes, VoteBehavior::DefaultYes)
XRPL_FIX (Cleanup3_4_0, Supported::Yes, VoteBehavior::DefaultNo)
XRPL_FEATURE(Sponsor, Supported::Yes, VoteBehavior::DefaultNo)
XRPL_FEATURE(BatchV1_1, Supported::Yes, VoteBehavior::DefaultNo)
@@ -144,3 +145,21 @@ XRPL_RETIRE_FEATURE(SortedDirectories)
XRPL_RETIRE_FEATURE(TicketBatch)
XRPL_RETIRE_FEATURE(TickSize)
XRPL_RETIRE_FEATURE(TrustSetAuth)
XRPL_FEATURE(SmartEscrow, Supported::No, VoteBehavior::DefaultNo)
XRPL_FEATURE(LendingProtocolV1_2, Supported::No, VoteBehavior::DefaultNo)
XRPL_FIX (Cleanup3_5_0, Supported::Yes, VoteBehavior::DefaultNo)
XRPL_FEATURE(ConfidentialMPTKeyRotation, Supported::No, VoteBehavior::DefaultNo)
XRPL_FEATURE(AMMCurves, Supported::Yes, VoteBehavior::DefaultNo)
XRPL_FEATURE(MPTStructuredData, Supported::Yes, VoteBehavior::DefaultNo)
XRPL_FEATURE(Quantum, Supported::Yes, VoteBehavior::DefaultNo)
XRPL_FEATURE(ConfidentialVoting, Supported::Yes, VoteBehavior::DefaultNo)
XRPL_FEATURE(TokenPaychan, Supported::Yes, VoteBehavior::DefaultNo)
XRPL_FEATURE(OfferQualifiers, Supported::Yes, VoteBehavior::DefaultNo)
XRPL_FEATURE(VaultContinuousAccrual, Supported::Yes, VoteBehavior::DefaultNo)
XRPL_FEATURE(Passkey, Supported::Yes, VoteBehavior::DefaultNo)
XRPL_FEATURE(Firewall, Supported::No, VoteBehavior::DefaultNo)
XRPL_FEATURE(Repo, Supported::No, VoteBehavior::DefaultNo)
XRPL_FEATURE(Beneficiary, Supported::No, VoteBehavior::DefaultNo)
XRPL_FEATURE(CouponPayments, Supported::Yes, VoteBehavior::DefaultNo)
XRPL_FEATURE(Subscription, Supported::No, VoteBehavior::DefaultNo)
XRPL_FEATURE(TokenIssuance, Supported::No, VoteBehavior::DefaultNo)

View File

@@ -153,6 +153,7 @@ LEDGER_ENTRY(ltACCOUNT_ROOT, 0x0061, AccountRoot, account, ({
{sfAMMID, SoeOptional}, // pseudo-account designator
{sfVaultID, SoeOptional}, // pseudo-account designator
{sfLoanBrokerID, SoeOptional}, // pseudo-account designator
{sfLastInteraction, SoeOptional},
}))
/** A ledger object which contains a list of object identifiers.
@@ -240,6 +241,7 @@ LEDGER_ENTRY(ltOFFER, 0x006f, Offer, offer, ({
{sfExpiration, SoeOptional},
{sfDomainID, SoeOptional},
{sfAdditionalBooks, SoeOptional},
{sfMinQuantity, SoeOptional},
}))
/** A ledger object which describes a deposit pre-authorization.
@@ -309,6 +311,11 @@ LEDGER_ENTRY(ltFEE_SETTINGS, 0x0073, FeeSettings, fee, ({
{sfBaseFeeDrops, SoeOptional},
{sfReserveBaseDrops, SoeOptional},
{sfReserveIncrementDrops, SoeOptional},
// Smart Escrow fields
{sfGasLimit, SoeOptional},
{sfBytecodeSizeLimit, SoeOptional},
{sfGasPrice, SoeOptional},
{sfPreviousTxnID, SoeOptional},
{sfPreviousTxnLgrSeq, SoeOptional},
}))
@@ -339,6 +346,8 @@ LEDGER_ENTRY(ltESCROW, 0x0075, Escrow, escrow, ({
{sfCondition, SoeOptional},
{sfCancelAfter, SoeOptional},
{sfFinishAfter, SoeOptional},
{sfBytecode, SoeOptional},
{sfData, SoeOptional},
{sfSourceTag, SoeOptional},
{sfDestinationTag, SoeOptional},
{sfOwnerNode, SoeRequired},
@@ -369,6 +378,8 @@ LEDGER_ENTRY(ltPAYCHAN, 0x0078, PayChannel, payment_channel, ({
{sfPreviousTxnID, SoeRequired},
{sfPreviousTxnLgrSeq, SoeRequired},
{sfDestinationNode, SoeOptional},
{sfTransferRate, SoeOptional},
{sfIssuerNode, SoeOptional},
}))
/** The ledger object which tracks the AMM.
@@ -386,6 +397,112 @@ LEDGER_ENTRY(ltAMM, 0x0079, AMM, amm, ({
{sfOwnerNode, SoeRequired},
{sfPreviousTxnID, SoeOptional},
{sfPreviousTxnLgrSeq, SoeOptional},
{sfCurveType, SoeDefault},
{sfFeeTier, SoeOptional},
{sfTickSpacing, SoeOptional},
{sfCurrentTick, SoeOptional},
{sfActiveLiquidity, SoeOptional},
{sfSqrtPriceX96, SoeOptional},
{sfFeeGrowthGlobal0, SoeOptional},
{sfFeeGrowthGlobal1, SoeOptional},
{sfAmplification, SoeOptional},
{sfAmplificationTime, SoeOptional},
{sfPositionCount, SoeDefault},
{sfBinStep, SoeOptional},
{sfActiveBinID, SoeOptional},
}))
/** A concentrated liquidity position within an AMM pool.
\sa keylet::ammPosition
*/
LEDGER_ENTRY(ltAMM_POSITION, 0x007a, AMMPosition, amm_position, ({
{sfAccount, SoeRequired},
{sfAMMID, SoeRequired},
{sfTickLower, SoeRequired},
{sfTickUpper, SoeRequired},
{sfPositionLiquidity, SoeRequired},
{sfFeeGrowthInsideLast0, SoeRequired},
{sfFeeGrowthInsideLast1, SoeRequired},
{sfTokensOwed0, SoeDefault},
{sfTokensOwed1, SoeDefault},
{sfOwnerNode, SoeRequired},
}))
/** A tick boundary for concentrated liquidity AMM pools.
\sa keylet::ammTick
*/
LEDGER_ENTRY(ltAMM_TICK, 0x007b, AMMTick, amm_tick, ({
{sfAMMID, SoeRequired},
{sfTickIndex, SoeRequired},
{sfLiquidityNet, SoeRequired}, // stored as UINT64, interpreted as signed
{sfLiquidityGross, SoeRequired},
{sfFeeGrowthOutside0, SoeRequired},
{sfFeeGrowthOutside1, SoeRequired},
{sfOwnerNode, SoeRequired},
}))
/** A 256-tick presence bitmap for concentrated liquidity AMM pools.
Each entry covers ticks [wordIndex*256 - 887272, wordIndex*256 + 255 - 887272].
Replaces SHAMap pred/succ on individual tick keylets with a bit-scan over a
cached 256-bit word — O(1) per crossing inside one word vs O(log N) per
crossing without. Entries are sparse: only words containing at least one
initialised tick have an SLE.
\sa keylet::ammTickBitmapWord
*/
LEDGER_ENTRY(ltAMM_TICK_BITMAP, 0x007c, AMMTickBitmap, amm_tick_bitmap, ({
{sfAMMID, SoeRequired},
{sfBitmapWordIndex, SoeRequired},
{sfBitmapBits, SoeRequired},
{sfOwnerNode, SoeRequired},
}))
/** A single bin within a binned-curve AMM pool. Each bin holds reserves
of both assets at a fixed price (constant-sum within bin). The bin
SLE is lazily instantiated on first deposit. Aggregate LP claim is
tracked via sfOutstandingAmount; per-LP claims live in
ltAMM_BIN_HOLDING records.
Phase 5 will replace per-LP holdings with MPT shares (transferable);
sfMPTokenIssuanceID is reserved for that migration.
\sa keylet::ammBin
*/
LEDGER_ENTRY(ltAMM_BIN, 0x0093, AMMBin, amm_bin, ({
{sfAMMID, SoeRequired},
{sfBinID, SoeRequired},
{sfReserve0, SoeRequired},
{sfReserve1, SoeRequired},
{sfFeeGrowthBin0, SoeRequired},
{sfFeeGrowthBin1, SoeRequired},
{sfOutstandingAmount, SoeRequired},
{sfMPTokenIssuanceID, SoeOptional},
{sfOwnerNode, SoeRequired},
}))
/** Per-LP fee-snapshot record for a single bin of a binned-curve AMM.
Keyed by (ammID, owner, binID). The MPT balance held by the LP is
the share quantity (source of truth); this SLE only carries the
feeGrowth snapshot so AMMCollectFees can compute owed fees as
`mpt_balance * (current_feeGrowth - snapshot)`.
Auto-created on demand by AMMCollectFees when an LP has bin MPTs
but no snapshot yet — happens when they received the MPT via
transfer rather than via AMMDeposit. The snapshot is set to the
current feeGrowth, so transfer recipients only collect on future
swaps (past fees were the original LP's to collect).
\sa keylet::ammBinHolding
*/
LEDGER_ENTRY(ltAMM_BIN_HOLDING, 0x0094, AMMBinHolding, amm_bin_holding, ({
{sfAccount, SoeRequired},
{sfAMMID, SoeRequired},
{sfBinID, SoeRequired},
{sfFeeGrowthInsideLast0, SoeRequired},
{sfFeeGrowthInsideLast1, SoeRequired},
{sfOwnerNode, SoeRequired},
}))
/** A ledger object which tracks MPTokenIssuance
@@ -401,6 +518,7 @@ LEDGER_ENTRY(ltMPTOKEN_ISSUANCE, 0x007e, MPTokenIssuance, mpt_issuance, ({
{sfOutstandingAmount, SoeRequired},
{sfLockedAmount, SoeOptional},
{sfMPTokenMetadata, SoeOptional},
{sfMPTokenSchema, SoeOptional},
{sfPreviousTxnID, SoeRequired},
{sfPreviousTxnLgrSeq, SoeRequired},
{sfDomainID, SoeOptional},
@@ -408,7 +526,11 @@ LEDGER_ENTRY(ltMPTOKEN_ISSUANCE, 0x007e, MPTokenIssuance, mpt_issuance, ({
{sfReferenceHolding, SoeOptional},
{sfIssuerEncryptionKey, SoeOptional},
{sfAuditorEncryptionKey, SoeOptional},
{sfIssuerKeyEpoch, SoeOptional},
{sfAuditorKeyEpoch, SoeOptional},
{sfConfidentialOutstandingAmount, SoeDefault},
{sfTokenIssuanceID, SoeOptional},
{sfBallotID, SoeOptional}, // ConfidentialVoting: the issuance's open ballot, if any
}))
/** A ledger object which tracks MPToken
@@ -428,6 +550,11 @@ LEDGER_ENTRY(ltMPTOKEN, 0x007f, MPToken, mptoken, ({
{sfIssuerEncryptedBalance, SoeOptional},
{sfAuditorEncryptedBalance, SoeOptional},
{sfHolderEncryptionKey, SoeOptional},
{sfCouponAccrued, SoeOptional},
{sfCouponIndex, SoeOptional},
{sfRedemptionAfter, SoeDefault},
{sfVoteLockedAmount, SoeOptional}, // ConfidentialVoting: locked while a ballot is open
{sfBallotID, SoeOptional}, // ConfidentialVoting: the ballot holding the lock
}))
/** A ledger object which tracks Oracle
@@ -502,13 +629,24 @@ LEDGER_ENTRY(ltVAULT, 0x0084, Vault, vault, ({
{sfAssetsAvailable, SoeDefault},
{sfAssetsMaximum, SoeDefault},
{sfLossUnrealized, SoeDefault},
{sfUnearnedInterest, SoeDefault},
{sfAccrualRate, SoeDefault},
{sfLastAccrualTime, SoeDefault},
{sfShareMPTID, SoeRequired},
{sfWithdrawalPolicy, SoeRequired},
{sfAccountingMethod, SoeDefault},
{sfScale, SoeDefault},
{sfLEVersion, SoeDefault},
{sfVaultKind, SoeDefault},
{sfSubscriptionDate, SoeOptional},
{sfRedemptionDate, SoeOptional},
{sfDealingInterval, SoeDefault},
{sfDealingWindow, SoeDefault},
{sfStruckPrice, SoeDefault},
{sfStruckUntil, SoeDefault},
{sfDepositFee, SoeDefault},
{sfRedemptionFee, SoeDefault},
{sfRedemptionPeriod, SoeDefault},
// no SharesTotal ever (use MPTIssuance.sfOutstandingAmount)
// no PermissionedDomainID ever (use MPTIssuance.sfDomainID)
}))
@@ -640,5 +778,180 @@ LEDGER_ENTRY(ltSPONSORSHIP, 0x0090, Sponsorship, sponsorship, ({
{sfSponseeNode, SoeRequired},
}))
/** A ledger object representing a confidential ballot with a homomorphically
encrypted tally.
\sa keylet::ballot
*/
LEDGER_ENTRY(ltBALLOT, 0x0091, Ballot, ballot, ({
{sfOwner, SoeRequired},
{sfSequence, SoeRequired},
{sfMPTokenIssuanceID, SoeOptional}, // token mode (one-of with sfDomainID)
{sfDomainID, SoeOptional}, // credential mode (one-of)
{sfDigest, SoeRequired}, // hash of the off-ledger ballot document
{sfURI, SoeOptional},
{sfOptionCount, SoeRequired},
{sfTallyPublicKey, SoeRequired},
{sfAuditorEncryptionKey, SoeOptional}, // optional auditor ElGamal key
{sfEncryptedTally, SoeRequired}, // one ElGamal ciphertext per option
{sfOpenTime, SoeRequired},
{sfCloseTime, SoeRequired},
{sfVoteCount, SoeDefault},
{sfResults, SoeOptional}, // plaintext counts, present after finalize
{sfOwnerNode, SoeRequired},
{sfPreviousTxnID, SoeRequired},
{sfPreviousTxnLgrSeq, SoeRequired},
}))
/** A ledger object recording a single voter's cast on a Ballot.
\sa keylet::ballotVote
*/
LEDGER_ENTRY(ltBALLOT_VOTE, 0x0092, BallotVote, ballot_vote, ({
{sfAccount, SoeRequired}, // voter
{sfBallotID, SoeRequired},
{sfBallotWeight, SoeRequired},
{sfEncryptedVotes, SoeRequired}, // vote vector under the tally key
{sfAuditorEncryptedVotes, SoeOptional}, // present iff the ballot has an auditor key
{sfVoterPublicKey, SoeOptional}, // present iff lsfVoterRecoverable
{sfVoterEncryptedVotes, SoeOptional}, // present iff lsfVoterRecoverable
{sfOwnerNode, SoeRequired},
{sfPreviousTxnID, SoeRequired},
{sfPreviousTxnLgrSeq, SoeRequired},
}))
/** A ledger object representing a passkey list.
\sa keylet::passkeyList
*/
LEDGER_ENTRY(ltPASSKEY_LIST, 0x0095, PasskeyList, passkey_list, ({
{sfPreviousTxnID, SoeRequired},
{sfPreviousTxnLgrSeq, SoeRequired},
{sfOwnerNode, SoeRequired},
{sfOwner, SoeRequired},
{sfPasskeys, SoeRequired},
}))
/** A ledger object which blocks an account's outgoing value until a
counterparty co-signs, or the destination is preauthorized.
\sa keylet::firewall
*/
LEDGER_ENTRY(ltFIREWALL, 0x0085, Firewall, firewall, ({
{sfOwner, SoeRequired},
{sfCounterparty, SoeRequired},
{sfMaxFee, SoeOptional},
{sfOwnerNode, SoeRequired},
{sfPreviousTxnID, SoeRequired},
{sfPreviousTxnLgrSeq, SoeRequired},
}))
/** A ledger object which preauthorizes one destination of a firewalled account.
\sa keylet::withdrawPreauth
*/
LEDGER_ENTRY_DUPLICATE(ltWITHDRAW_PREAUTH, 0x0086, WithdrawPreauth, withdraw_preauth, ({
{sfAccount, SoeRequired},
{sfAuthorize, SoeRequired},
{sfDestinationTag, SoeOptional},
{sfOwnerNode, SoeRequired},
{sfPreviousTxnID, SoeRequired},
{sfPreviousTxnLgrSeq, SoeRequired},
}))
/**
* A bilateral repurchase agreement. The seller locks collateral and receives
* cash; the entry is pending until the buyer accepts, active thereafter.
* \sa keylet::repo
*/
LEDGER_ENTRY(ltREPO, 0x0096, Repo, repo, ({
{sfAccount, SoeRequired},
{sfCounterparty, SoeRequired},
{sfCollateralAmount, SoeRequired, SoeMptSupported},
{sfPurchasePrice, SoeRequired, SoeMptSupported},
{sfInterestRate, SoeRequired},
{sfExpiration, SoeRequired},
{sfStartDate, SoeOptional},
{sfMaturityDate, SoeRequired},
{sfGracePeriod, SoeRequired},
{sfTransferRate, SoeOptional},
{sfData, SoeOptional},
{sfOwnerNode, SoeRequired},
{sfDestinationNode, SoeRequired},
{sfIssuerNode, SoeOptional},
{sfPreviousTxnID, SoeRequired},
{sfPreviousTxnLgrSeq, SoeRequired},
}))
/** A designation of an account to receive this account's regular key after a
period of inactivity.
\sa keylet::beneficiary
*/
LEDGER_ENTRY(ltBENEFICIARY, 0x0097, Beneficiary, beneficiary, ({
{sfAccount, SoeRequired},
{sfBeneficiary, SoeRequired},
{sfTimeLock, SoeRequired},
{sfOwnerNode, SoeRequired},
{sfPreviousTxnID, SoeRequired},
{sfPreviousTxnLgrSeq, SoeRequired},
}))
/** A ledger object representing a bond coupon schedule: the issuer's
standing offer of fixed periodic coupon payments per unit of a bond
asset, in a settlement asset. One schedule per (Account, BondAsset).
\sa keylet::couponSchedule
*/
LEDGER_ENTRY(ltCOUPON_SCHEDULE, 0x0098, CouponSchedule, coupon_schedule, ({
{sfPreviousTxnID, SoeRequired},
{sfPreviousTxnLgrSeq, SoeRequired},
{sfOwnerNode, SoeRequired},
{sfOwner, SoeRequired},
{sfAccount, SoeRequired},
{sfMPTokenIssuanceID, SoeRequired},
{sfCouponAsset, SoeRequired},
{sfAccruedPerUnit, SoeDefault},
{sfPoolAmount, SoeDefault},
{sfClaimantCount, SoeDefault},
{sfCouponCount, SoeDefault},
{sfLastCouponTime, SoeOptional},
{sfCouponAmount, SoeOptional},
{sfCouponInterval, SoeOptional},
{sfFirstCouponTime, SoeOptional},
{sfExpiration, SoeOptional},
{sfCallNoticePeriod, SoeOptional},
{sfEarliestCallTime, SoeOptional},
}))
/** A ledger object representing a subscription.
\sa keylet::subscription
*/
LEDGER_ENTRY(ltSUBSCRIPTION, 0x008A, Subscription, subscription, ({
{sfPreviousTxnID, SoeRequired},
{sfPreviousTxnLgrSeq, SoeRequired},
{sfSequence, SoeRequired},
{sfOwnerNode, SoeRequired},
{sfAccount, SoeRequired},
{sfDestination, SoeRequired},
{sfDestinationTag, SoeOptional},
{sfAmount, SoeRequired},
{sfBalance, SoeRequired},
{sfFrequency, SoeRequired},
{sfNextClaimTime, SoeRequired},
{sfExpiration, SoeOptional},
{sfDestinationNode, SoeRequired},
}))
/** A ledger object which describes an IOU token issuance.
\sa keylet::tokenIssuance
*/
LEDGER_ENTRY(ltTOKEN_ISSUANCE, 0x0099, TokenIssuance, token_issuance, ({
{sfIssuer, SoeRequired},
{sfCurrency, SoeRequired},
{sfMaximumAmount, SoeOptional},
{sfIssuedAmount, SoeDefault},
{sfTokenScale, SoeDefault},
{sfMPTokenIssuanceID, SoeOptional},
{sfTransferFee, SoeOptional},
{sfMPTokenMetadata, SoeOptional},
{sfOwnerNode, SoeRequired},
{sfPreviousTxnID, SoeRequired},
{sfPreviousTxnLgrSeq, SoeRequired},
}))
#undef EXPAND
#undef LEDGER_ENTRY_DUPLICATE

View File

@@ -28,6 +28,8 @@ TYPED_SFIELD(sfWasLockingChainSend, UINT8, 19)
TYPED_SFIELD(sfWithdrawalPolicy, UINT8, 20)
TYPED_SFIELD(sfContractResult, UINT8, 21)
TYPED_SFIELD(sfVaultKind, UINT8, 22)
TYPED_SFIELD(sfCurveType, UINT8, 24)
TYPED_SFIELD(sfFeeTier, UINT8, 25)
// 16-bit integers (common)
TYPED_SFIELD(sfLedgerEntryType, UINT16, 1, SField::kSmdNever)
@@ -42,6 +44,13 @@ TYPED_SFIELD(sfVersion, UINT16, 16)
// 17 to 20 unused
TYPED_SFIELD(sfLedgerFixType, UINT16, 21)
TYPED_SFIELD(sfManagementFeeRate, UINT16, 22) // 1/10 basis points (bips)
TYPED_SFIELD(sfTickSpacing, UINT16, 23)
TYPED_SFIELD(sfWeight, UINT16, 24)
// Index of a 256-tick window within the CL tick-presence bitmap. word = (tick + 887272) / 256.
// Range [0, 6931] so UINT16 is plenty.
TYPED_SFIELD(sfBitmapWordIndex, UINT16, 25)
// Binned-curve: bin width in basis points. price(id) = (1 + step/10000)^id.
TYPED_SFIELD(sfBinStep, UINT16, 26)
// 32-bit integers (common)
TYPED_SFIELD(sfNetworkID, UINT32, 1)
@@ -119,6 +128,19 @@ TYPED_SFIELD(sfRemainingOwnerCount, UINT32, 73)
TYPED_SFIELD(sfSponsorFlags, UINT32, 74)
TYPED_SFIELD(sfSubscriptionDate, UINT32, 75)
TYPED_SFIELD(sfRedemptionDate, UINT32, 76)
TYPED_SFIELD(sfIssuerKeyEpoch, UINT32, 77)
TYPED_SFIELD(sfAuditorKeyEpoch, UINT32, 78)
TYPED_SFIELD(sfIssuerKeyMirrorEpoch, UINT32, 79)
TYPED_SFIELD(sfAuditorKeyMirrorEpoch, UINT32, 80)
TYPED_SFIELD(sfGasLimit, UINT32, 81)
TYPED_SFIELD(sfBytecodeSizeLimit, UINT32, 82)
TYPED_SFIELD(sfGasPrice, UINT32, 83)
TYPED_SFIELD(sfGas, UINT32, 84)
TYPED_SFIELD(sfGasUsed, UINT32, 85)
TYPED_SFIELD(sfAmplification, UINT32, 91)
TYPED_SFIELD(sfAmplificationTarget, UINT32, 92)
TYPED_SFIELD(sfAmplificationTime, UINT32, 93)
TYPED_SFIELD(sfPositionCount, UINT32, 94)
// 64-bit integers (common)
TYPED_SFIELD(sfIndexNext, UINT64, 1)
@@ -152,6 +174,13 @@ TYPED_SFIELD(sfVaultNode, UINT64, 30)
TYPED_SFIELD(sfLoanBrokerNode, UINT64, 31)
TYPED_SFIELD(sfConfidentialOutstandingAmount, UINT64, 32, SField::kSmdBaseTen|SField::kSmdDefault)
TYPED_SFIELD(sfSponseeNode, UINT64, 33)
TYPED_SFIELD(sfActiveLiquidity, UINT64, 39)
TYPED_SFIELD(sfPositionLiquidity, UINT64, 40)
TYPED_SFIELD(sfLiquidityGross, UINT64, 36)
TYPED_SFIELD(sfLiquidityNet, UINT64, 37)
// Binned-curve: an LP's proportional claim on a bin's aggregate
// liquidity. Sum of all holders' sfShares == bin's sfOutstandingAmount.
TYPED_SFIELD(sfShares, UINT64, 38)
// 128-bit
TYPED_SFIELD(sfEmailHash, UINT128, 1)
@@ -211,6 +240,16 @@ TYPED_SFIELD(sfLoanID, UINT256, 38)
TYPED_SFIELD(sfReferenceHolding, UINT256, 39)
TYPED_SFIELD(sfBlindingFactor, UINT256, 40)
TYPED_SFIELD(sfObjectID, UINT256, 41)
TYPED_SFIELD(sfSqrtPriceX96, UINT256, 45)
// 256-bit bitmap of initialised-tick presence within a single 256-tick window
// of a CL pool. Bit i (0-indexed from least-significant) set => tick
// (wordIndex * 256 + i - 887272) is initialised. Read via byte order:
// least-significant 32-bit lane first. See findNextInitTickBitmap.
TYPED_SFIELD(sfBitmapBits, UINT256, 46)
// Position keylet hash: addresses a specific ltAMM_POSITION SLE owned by the
// transactor. Used as a tx-input field on AMMWithdraw, AMMCollectFees, and
// AMMPositionTransfer to identify which of the LP's positions to operate on.
TYPED_SFIELD(sfPositionID, UINT256, 44)
// number (common)
TYPED_SFIELD(sfNumber, NUMBER, 1)
@@ -230,10 +269,33 @@ TYPED_SFIELD(sfPrincipalRequested, NUMBER, 14)
TYPED_SFIELD(sfTotalValueOutstanding, NUMBER, 15, SField::kSmdNeedsAsset | SField::kSmdDefault)
TYPED_SFIELD(sfPeriodicPayment, NUMBER, 16)
TYPED_SFIELD(sfManagementFeeOutstanding, NUMBER, 17, SField::kSmdNeedsAsset | SField::kSmdDefault)
// Concentrated-liquidity fee-growth accumulators. v3 uses Q128.128 in
// uint256 because Solidity lacks a native fractional type; XRPL has
// Number (16-digit mantissa, 32-bit exponent) which is strictly more
// capable for "fee per unit liquidity". No asset association — the
// value is dimensionless growth-per-liquidity.
TYPED_SFIELD(sfFeeGrowthGlobal0, NUMBER, 18)
TYPED_SFIELD(sfFeeGrowthGlobal1, NUMBER, 19)
TYPED_SFIELD(sfFeeGrowthOutside0, NUMBER, 20)
TYPED_SFIELD(sfFeeGrowthOutside1, NUMBER, 21)
TYPED_SFIELD(sfFeeGrowthInsideLast0, NUMBER, 22)
TYPED_SFIELD(sfFeeGrowthInsideLast1, NUMBER, 23)
// Binned-curve per-bin fee accumulators (fee per MPT-share-unit).
TYPED_SFIELD(sfFeeGrowthBin0, NUMBER, 24)
TYPED_SFIELD(sfFeeGrowthBin1, NUMBER, 25)
// 32-bit signed (common)
TYPED_SFIELD(sfLoanScale, INT32, 1)
TYPED_SFIELD(sfRemainingOwnerCountDelta, INT32, 2)
TYPED_SFIELD(sfVMReturnCode, INT32, 3)
TYPED_SFIELD(sfTickLower, INT32, 8)
TYPED_SFIELD(sfTickUpper, INT32, 9)
TYPED_SFIELD(sfTickIndex, INT32, 4)
TYPED_SFIELD(sfCurrentTick, INT32, 5)
// Binned-curve indices.
TYPED_SFIELD(sfBinID, INT32, 6)
TYPED_SFIELD(sfActiveBinID, INT32, 7)
// currency amount (common)
TYPED_SFIELD(sfAmount, AMOUNT, 1)
@@ -272,6 +334,11 @@ TYPED_SFIELD(sfLPTokenBalance, AMOUNT, 31)
TYPED_SFIELD(sfFeeAmount, AMOUNT, 32)
TYPED_SFIELD(sfMaxFee, AMOUNT, 33)
TYPED_SFIELD(sfFeeAmountDelta, AMOUNT, 34)
TYPED_SFIELD(sfTokensOwed0, AMOUNT, 38)
TYPED_SFIELD(sfTokensOwed1, AMOUNT, 35)
// Binned-curve per-bin reserves (asset0 / asset1 inventory at the bin's price).
TYPED_SFIELD(sfReserve0, AMOUNT, 36)
TYPED_SFIELD(sfReserve1, AMOUNT, 37)
// variable length (common)
TYPED_SFIELD(sfPublicKey, VL, 1)
@@ -318,6 +385,7 @@ TYPED_SFIELD(sfAuditorEncryptedAmount, VL, 43)
TYPED_SFIELD(sfAuditorEncryptionKey, VL, 44)
TYPED_SFIELD(sfAmountCommitment, VL, 45)
TYPED_SFIELD(sfBalanceCommitment, VL, 46)
TYPED_SFIELD(sfBytecode, VL, 47)
// account (common)
TYPED_SFIELD(sfAccount, ACCOUNT, 1)
@@ -442,3 +510,72 @@ UNTYPED_SFIELD(sfAcceptedCredentials, ARRAY, 28)
UNTYPED_SFIELD(sfPermissions, ARRAY, 29)
UNTYPED_SFIELD(sfRawTransactions, ARRAY, 30)
UNTYPED_SFIELD(sfBatchSigners, ARRAY, 31, SField::kSmdDefault, SField::kNotSigning)
TYPED_SFIELD(sfMPTokenSchema, VL, 48)
TYPED_SFIELD(sfOptionCount, UINT8, 23)
TYPED_SFIELD(sfOpenTime, UINT32, 89)
TYPED_SFIELD(sfVoteCount, UINT32, 90)
TYPED_SFIELD(sfBallotWeight, UINT64, 34)
TYPED_SFIELD(sfVoteLockedAmount, UINT64, 35, SField::kSmdBaseTen|SField::kSmdDefault)
TYPED_SFIELD(sfBallotID, UINT256, 43)
TYPED_SFIELD(sfEncryptedVote, VL, 49)
TYPED_SFIELD(sfTallyPublicKey, VL, 50)
TYPED_SFIELD(sfVoterPublicKey, VL, 51)
UNTYPED_SFIELD(sfBallotOption, OBJECT, 39)
UNTYPED_SFIELD(sfBallotResult, OBJECT, 40)
UNTYPED_SFIELD(sfEncryptedTally, ARRAY, 32)
UNTYPED_SFIELD(sfEncryptedVotes, ARRAY, 33)
UNTYPED_SFIELD(sfAuditorEncryptedVotes, ARRAY, 34)
UNTYPED_SFIELD(sfVoterEncryptedVotes, ARRAY, 35)
UNTYPED_SFIELD(sfResults, ARRAY, 36)
TYPED_SFIELD(sfMinQuantity, AMOUNT, 39)
TYPED_SFIELD(sfAccountingMethod, UINT8, 26)
TYPED_SFIELD(sfLastAccrualTime, UINT32, 86)
TYPED_SFIELD(sfDealingInterval, UINT32, 87)
TYPED_SFIELD(sfDealingWindow, UINT32, 88)
TYPED_SFIELD(sfStruckUntil, UINT32, 95)
TYPED_SFIELD(sfDepositFee, UINT32, 96)
TYPED_SFIELD(sfRedemptionFee, UINT32, 97)
TYPED_SFIELD(sfRedemptionPeriod, UINT32, 98)
TYPED_SFIELD(sfRedemptionAfter, UINT32, 99)
TYPED_SFIELD(sfUnearnedInterest, NUMBER, 26, SField::kSmdNeedsAsset | SField::kSmdDefault)
// Assets earned per second, summed over a vault's performing loans. A rate,
// not an amount, so it carries no asset association.
TYPED_SFIELD(sfAccrualRate, NUMBER, 27, SField::kSmdDefault)
TYPED_SFIELD(sfStruckPrice, NUMBER, 28, SField::kSmdDefault)
TYPED_SFIELD(sfSignCount, UINT32, 100)
TYPED_SFIELD(sfPasskeyID, VL, 52)
TYPED_SFIELD(sfAuthenticatorData, VL, 53)
TYPED_SFIELD(sfClientDataJSON, VL, 54)
UNTYPED_SFIELD(sfPasskeySignature, OBJECT, 41, SField::kSmdDefault, SField::kNotSigning)
UNTYPED_SFIELD(sfPasskey, OBJECT, 42)
UNTYPED_SFIELD(sfPasskeys, ARRAY, 37)
TYPED_SFIELD(sfFirewallID, UINT256, 42)
TYPED_SFIELD(sfBackup, ACCOUNT, 32)
TYPED_SFIELD(sfMaturityDate, UINT32, 101)
TYPED_SFIELD(sfRepoID, UINT256, 47)
TYPED_SFIELD(sfCollateralAmount, AMOUNT, 40)
TYPED_SFIELD(sfPurchasePrice, AMOUNT, 41)
TYPED_SFIELD(sfTimeLock, UINT32, 102)
TYPED_SFIELD(sfLastInteraction, UINT32, 103)
TYPED_SFIELD(sfBeneficiary, ACCOUNT, 33)
TYPED_SFIELD(sfCouponInterval, UINT32, 104)
TYPED_SFIELD(sfFirstCouponTime, UINT32, 105)
TYPED_SFIELD(sfCallNoticePeriod, UINT32, 106)
TYPED_SFIELD(sfEarliestCallTime, UINT32, 107)
TYPED_SFIELD(sfLastCouponTime, UINT32, 108)
TYPED_SFIELD(sfClaimantCount, UINT32, 109)
TYPED_SFIELD(sfCouponCount, UINT32, 110)
TYPED_SFIELD(sfCouponAmount, AMOUNT, 42)
TYPED_SFIELD(sfAccruedPerUnit, AMOUNT, 43)
TYPED_SFIELD(sfPoolAmount, AMOUNT, 44)
TYPED_SFIELD(sfCouponAccrued, AMOUNT, 45)
TYPED_SFIELD(sfCouponIndex, AMOUNT, 46)
TYPED_SFIELD(sfCouponAsset, ISSUE, 5)
TYPED_SFIELD(sfFrequency, UINT32, 111)
TYPED_SFIELD(sfStartTime, UINT32, 112)
TYPED_SFIELD(sfNextClaimTime, UINT32, 113)
TYPED_SFIELD(sfSubscriptionID, UINT256, 48)
TYPED_SFIELD(sfTokenScale, UINT8, 7)
TYPED_SFIELD(sfTokenIssuanceID, UINT256, 49)
TYPED_SFIELD(sfIssuedAmount, NUMBER, 29, SField::kSmdNeedsAsset | SField::kSmdDefault)
TYPED_SFIELD(sfCurrency, CURRENCY, 3)

View File

@@ -47,7 +47,7 @@
# include <xrpl/tx/transactors/payment/Payment.h>
#endif
TRANSACTION(ttPAYMENT, 0, Payment,
({.delegable = Delegation::Delegable, .privileges = Privilege::CreateAcct | Privilege::MayCreateMpt}),
({.delegable = Delegation::Delegable, .privileges = Privilege::CreateAcct | Privilege::MayCreateMpt, .firewall = FirewallAction::Check}),
({
{sfDestination, SoeRequired},
{sfAmount, SoeRequired, SoeMptSupported},
@@ -64,25 +64,28 @@ TRANSACTION(ttPAYMENT, 0, Payment,
#if TRANSACTION_INCLUDE
# include <xrpl/tx/transactors/escrow/EscrowCreate.h>
#endif
TRANSACTION(ttESCROW_CREATE, 1, EscrowCreate, ({.delegable = Delegation::Delegable}), ({
TRANSACTION(ttESCROW_CREATE, 1, EscrowCreate, ({.delegable = Delegation::Delegable, .firewall = FirewallAction::Check}), ({
{sfDestination, SoeRequired},
{sfDestinationTag, SoeOptional},
{sfAmount, SoeRequired, SoeMptSupported},
{sfCondition, SoeOptional},
{sfCancelAfter, SoeOptional},
{sfFinishAfter, SoeOptional},
{sfDestinationTag, SoeOptional},
{sfBytecode, SoeOptional},
{sfData, SoeOptional},
}))
/** This transaction type completes an existing escrow. */
#if TRANSACTION_INCLUDE
# include <xrpl/tx/transactors/escrow/EscrowFinish.h>
#endif
TRANSACTION(ttESCROW_FINISH, 2, EscrowFinish, ({.delegable = Delegation::Delegable}), ({
TRANSACTION(ttESCROW_FINISH, 2, EscrowFinish, ({.delegable = Delegation::Delegable, .firewall = FirewallAction::Check}), ({
{sfOwner, SoeRequired},
{sfOfferSequence, SoeRequired},
{sfFulfillment, SoeOptional},
{sfCondition, SoeOptional},
{sfCredentialIDs, SoeOptional},
{sfGas, SoeOptional},
}))
@@ -109,7 +112,7 @@ TRANSACTION(ttACCOUNT_SET, 3, AccountSet,
#if TRANSACTION_INCLUDE
# include <xrpl/tx/transactors/escrow/EscrowCancel.h>
#endif
TRANSACTION(ttESCROW_CANCEL, 4, EscrowCancel, ({.delegable = Delegation::Delegable}), ({
TRANSACTION(ttESCROW_CANCEL, 4, EscrowCancel, ({.delegable = Delegation::Delegable, .firewall = FirewallAction::Check}), ({
{sfOwner, SoeRequired},
{sfOfferSequence, SoeRequired},
}))
@@ -131,13 +134,14 @@ TRANSACTION(ttREGULAR_KEY_SET, 5, SetRegularKey,
# include <xrpl/tx/transactors/dex/OfferCreate.h>
#endif
TRANSACTION(ttOFFER_CREATE, 7, OfferCreate,
({.delegable = Delegation::Delegable, .privileges = Privilege::MayCreateMpt}),
({.delegable = Delegation::Delegable, .privileges = Privilege::MayCreateMpt, .firewall = FirewallAction::Block}),
({
{sfTakerPays, SoeRequired, SoeMptSupported},
{sfTakerGets, SoeRequired, SoeMptSupported},
{sfExpiration, SoeOptional},
{sfOfferSequence, SoeOptional},
{sfDomainID, SoeOptional},
{sfMinQuantity, SoeOptional},
}))
/** This transaction type cancels existing offers to trade one asset for another. */
@@ -177,9 +181,9 @@ TRANSACTION(ttSIGNER_LIST_SET, 12, SignerListSet,
#if TRANSACTION_INCLUDE
# include <xrpl/tx/transactors/payment_channel/PaymentChannelCreate.h>
#endif
TRANSACTION(ttPAYCHAN_CREATE, 13, PaymentChannelCreate, ({.delegable = Delegation::Delegable}), ({
TRANSACTION(ttPAYCHAN_CREATE, 13, PaymentChannelCreate, ({.delegable = Delegation::Delegable, .firewall = FirewallAction::Check}), ({
{sfDestination, SoeRequired},
{sfAmount, SoeRequired},
{sfAmount, SoeRequired, SoeMptSupported},
{sfSettleDelay, SoeRequired},
{sfPublicKey, SoeRequired},
{sfCancelAfter, SoeOptional},
@@ -190,9 +194,9 @@ TRANSACTION(ttPAYCHAN_CREATE, 13, PaymentChannelCreate, ({.delegable = Delegatio
#if TRANSACTION_INCLUDE
# include <xrpl/tx/transactors/payment_channel/PaymentChannelFund.h>
#endif
TRANSACTION(ttPAYCHAN_FUND, 14, PaymentChannelFund, ({.delegable = Delegation::Delegable}), ({
TRANSACTION(ttPAYCHAN_FUND, 14, PaymentChannelFund, ({.delegable = Delegation::Delegable, .firewall = FirewallAction::Check}), ({
{sfChannel, SoeRequired},
{sfAmount, SoeRequired},
{sfAmount, SoeRequired, SoeMptSupported},
{sfExpiration, SoeOptional},
}))
@@ -202,8 +206,8 @@ TRANSACTION(ttPAYCHAN_FUND, 14, PaymentChannelFund, ({.delegable = Delegation::D
#endif
TRANSACTION(ttPAYCHAN_CLAIM, 15, PaymentChannelClaim, ({.delegable = Delegation::Delegable}), ({
{sfChannel, SoeRequired},
{sfAmount, SoeOptional},
{sfBalance, SoeOptional},
{sfAmount, SoeOptional, SoeMptSupported},
{sfBalance, SoeOptional, SoeMptSupported},
{sfSignature, SoeOptional},
{sfPublicKey, SoeOptional},
{sfCredentialIDs, SoeOptional},
@@ -213,7 +217,7 @@ TRANSACTION(ttPAYCHAN_CLAIM, 15, PaymentChannelClaim, ({.delegable = Delegation:
#if TRANSACTION_INCLUDE
# include <xrpl/tx/transactors/check/CheckCreate.h>
#endif
TRANSACTION(ttCHECK_CREATE, 16, CheckCreate, ({.delegable = Delegation::Delegable}), ({
TRANSACTION(ttCHECK_CREATE, 16, CheckCreate, ({.delegable = Delegation::Delegable, .firewall = FirewallAction::Check}), ({
{sfDestination, SoeRequired},
{sfSendMax, SoeRequired, SoeMptSupported},
{sfExpiration, SoeOptional},
@@ -283,7 +287,7 @@ TRANSACTION(ttACCOUNT_DELETE, 21, AccountDelete,
# include <xrpl/tx/transactors/nft/NFTokenMint.h>
#endif
TRANSACTION(ttNFTOKEN_MINT, 25, NFTokenMint,
({.delegable = Delegation::Delegable, .privileges = Privilege::ChangeNftCounts}),
({.delegable = Delegation::Delegable, .privileges = Privilege::ChangeNftCounts, .firewall = FirewallAction::Check}),
({
{sfNFTokenTaxon, SoeRequired},
{sfTransferFee, SoeOptional},
@@ -309,7 +313,7 @@ TRANSACTION(ttNFTOKEN_BURN, 26, NFTokenBurn,
#if TRANSACTION_INCLUDE
# include <xrpl/tx/transactors/nft/NFTokenCreateOffer.h>
#endif
TRANSACTION(ttNFTOKEN_CREATE_OFFER, 27, NFTokenCreateOffer, ({.delegable = Delegation::Delegable}), ({
TRANSACTION(ttNFTOKEN_CREATE_OFFER, 27, NFTokenCreateOffer, ({.delegable = Delegation::Delegable, .firewall = FirewallAction::Check}), ({
{sfNFTokenID, SoeRequired},
{sfAmount, SoeRequired},
{sfDestination, SoeOptional},
@@ -360,6 +364,7 @@ TRANSACTION(ttAMM_CLAWBACK, 31, AMMClawback,
{sfAsset, SoeRequired, SoeMptSupported},
{sfAsset2, SoeRequired, SoeMptSupported},
{sfAmount, SoeOptional, SoeMptSupported},
{sfCurveType, SoeOptional},
}))
/** This transaction type creates an AMM instance */
@@ -371,11 +376,16 @@ TRANSACTION(ttAMM_CREATE, 35, AMMCreate,
.delegable = Delegation::Delegable,
.amendment = featureAMM,
.privileges = Privilege::CreatePseudoAcct | Privilege::MayCreateMpt,
.firewall = FirewallAction::Block,
}),
({
{sfAmount, SoeRequired, SoeMptSupported},
{sfAmount2, SoeRequired, SoeMptSupported},
{sfTradingFee, SoeRequired},
{sfCurveType, SoeOptional},
{sfFeeTier, SoeOptional},
{sfAmplification, SoeOptional},
{sfBinStep, SoeOptional},
}))
/** This transaction type deposits into an AMM instance */
@@ -383,7 +393,7 @@ TRANSACTION(ttAMM_CREATE, 35, AMMCreate,
# include <xrpl/tx/transactors/dex/AMMDeposit.h>
#endif
TRANSACTION(ttAMM_DEPOSIT, 36, AMMDeposit,
({.delegable = Delegation::Delegable, .amendment = featureAMM}),
({.delegable = Delegation::Delegable, .amendment = featureAMM, .firewall = FirewallAction::Block}),
({
{sfAsset, SoeRequired, SoeMptSupported},
{sfAsset2, SoeRequired, SoeMptSupported},
@@ -392,6 +402,10 @@ TRANSACTION(ttAMM_DEPOSIT, 36, AMMDeposit,
{sfEPrice, SoeOptional},
{sfLPTokenOut, SoeOptional},
{sfTradingFee, SoeOptional},
{sfCurveType, SoeOptional},
{sfTickLower, SoeOptional},
{sfTickUpper, SoeOptional},
{sfBinID, SoeOptional},
}))
/** This transaction type withdraws from an AMM instance */
@@ -403,6 +417,7 @@ TRANSACTION(ttAMM_WITHDRAW, 37, AMMWithdraw,
.delegable = Delegation::Delegable,
.amendment = featureAMM,
.privileges = Privilege::MayDeleteAcct | Privilege::MayAuthorizeMpt,
.firewall = FirewallAction::Block,
}),
({
{sfAsset, SoeRequired, SoeMptSupported},
@@ -411,6 +426,11 @@ TRANSACTION(ttAMM_WITHDRAW, 37, AMMWithdraw,
{sfAmount2, SoeOptional, SoeMptSupported},
{sfEPrice, SoeOptional},
{sfLPTokenIn, SoeOptional},
{sfCurveType, SoeOptional},
{sfPositionID, SoeOptional},
{sfPositionLiquidity, SoeOptional},
{sfBinID, SoeOptional},
{sfShares, SoeOptional},
}))
/** This transaction type votes for the trading fee */
@@ -418,11 +438,13 @@ TRANSACTION(ttAMM_WITHDRAW, 37, AMMWithdraw,
# include <xrpl/tx/transactors/dex/AMMVote.h>
#endif
TRANSACTION(ttAMM_VOTE, 38, AMMVote,
({.delegable = Delegation::Delegable, .amendment = featureAMM}),
({.delegable = Delegation::Delegable, .amendment = featureAMM, .firewall = FirewallAction::Block}),
({
{sfAsset, SoeRequired, SoeMptSupported},
{sfAsset2, SoeRequired, SoeMptSupported},
{sfTradingFee, SoeRequired},
{sfTradingFee, SoeOptional},
{sfCurveType, SoeOptional},
{sfAmplification, SoeOptional},
}))
/** This transaction type bids for the auction slot */
@@ -430,10 +452,11 @@ TRANSACTION(ttAMM_VOTE, 38, AMMVote,
# include <xrpl/tx/transactors/dex/AMMBid.h>
#endif
TRANSACTION(ttAMM_BID, 39, AMMBid,
({.delegable = Delegation::Delegable, .amendment = featureAMM}),
({.delegable = Delegation::Delegable, .amendment = featureAMM, .firewall = FirewallAction::Block}),
({
{sfAsset, SoeRequired, SoeMptSupported},
{sfAsset2, SoeRequired, SoeMptSupported},
{sfCurveType, SoeOptional},
{sfBidMin, SoeOptional},
{sfBidMax, SoeOptional},
{sfAuthAccounts, SoeOptional},
@@ -448,10 +471,62 @@ TRANSACTION(ttAMM_DELETE, 40, AMMDelete,
.delegable = Delegation::Delegable,
.amendment = featureAMM,
.privileges = Privilege::MustDeleteAcct | Privilege::MayDeleteMpt,
.firewall = FirewallAction::Block,
}),
({
{sfAsset, SoeRequired, SoeMptSupported},
{sfAsset2, SoeRequired, SoeMptSupported},
{sfCurveType, SoeOptional},
}))
/** This transaction type collects accumulated fees from a CL position */
#if TRANSACTION_INCLUDE
# include <xrpl/tx/transactors/dex/AMMCollectFees.h>
#endif
TRANSACTION(ttAMM_COLLECT_FEES, 112, AMMCollectFees,
({.delegable = Delegation::Delegable, .amendment = featureAMMCurves}),
({
{sfAsset, SoeRequired, SoeMptSupported},
{sfAsset2, SoeRequired, SoeMptSupported},
{sfCurveType, SoeOptional},
{sfPositionID, SoeOptional},
{sfBinID, SoeOptional},
}))
/** This transaction type transfers ownership of a CL position SLE. */
#if TRANSACTION_INCLUDE
# include <xrpl/tx/transactors/dex/AMMPositionTransfer.h>
#endif
TRANSACTION(ttAMM_POSITION_TRANSFER, 113, AMMPositionTransfer,
({.delegable = Delegation::Delegable, .amendment = featureAMMCurves}),
({
{sfDestination, SoeRequired},
{sfPositionID, SoeRequired},
}))
/** Provision a bin in a CtBinned AMM (creates the per-bin MPT issuance). */
#if TRANSACTION_INCLUDE
# include <xrpl/tx/transactors/dex/AMMBinCreate.h>
#endif
TRANSACTION(ttAMM_BIN_CREATE, 110, AMMBinCreate,
({.delegable = Delegation::Delegable, .amendment = featureAMMCurves, .privileges = Privilege::CreateMptIssuance}),
({
{sfAsset, SoeRequired, SoeMptSupported},
{sfAsset2, SoeRequired, SoeMptSupported},
{sfBinID, SoeRequired},
}))
/** Decommission an empty bin in a CtBinned AMM (deletes the bin SLE
and its MPT issuance). Counterpart to AMMBinCreate. */
#if TRANSACTION_INCLUDE
# include <xrpl/tx/transactors/dex/AMMBinDestroy.h>
#endif
TRANSACTION(ttAMM_BIN_DESTROY, 111, AMMBinDestroy,
({.delegable = Delegation::Delegable, .amendment = featureAMMCurves, .privileges = Privilege::DestroyMptIssuance}),
({
{sfAsset, SoeRequired, SoeMptSupported},
{sfAsset2, SoeRequired, SoeMptSupported},
{sfBinID, SoeRequired},
}))
/** This transactions creates a crosschain sequence number */
@@ -459,7 +534,7 @@ TRANSACTION(ttAMM_DELETE, 40, AMMDelete,
# include <xrpl/tx/transactors/bridge/XChainBridge.h>
#endif
TRANSACTION(ttXCHAIN_CREATE_CLAIM_ID, 41, XChainCreateClaimID,
({.delegable = Delegation::Delegable, .amendment = featureXChainBridge}),
({.delegable = Delegation::Delegable, .amendment = featureXChainBridge, .firewall = FirewallAction::Block}),
({
{sfXChainBridge, SoeRequired},
{sfSignatureReward, SoeRequired},
@@ -468,7 +543,7 @@ TRANSACTION(ttXCHAIN_CREATE_CLAIM_ID, 41, XChainCreateClaimID,
/** This transactions initiates a crosschain transaction */
TRANSACTION(ttXCHAIN_COMMIT, 42, XChainCommit,
({.delegable = Delegation::Delegable, .amendment = featureXChainBridge}),
({.delegable = Delegation::Delegable, .amendment = featureXChainBridge, .firewall = FirewallAction::Block}),
({
{sfXChainBridge, SoeRequired},
{sfXChainClaimID, SoeRequired},
@@ -478,7 +553,7 @@ TRANSACTION(ttXCHAIN_COMMIT, 42, XChainCommit,
/** This transaction completes a crosschain transaction */
TRANSACTION(ttXCHAIN_CLAIM, 43, XChainClaim,
({.delegable = Delegation::Delegable, .amendment = featureXChainBridge}),
({.delegable = Delegation::Delegable, .amendment = featureXChainBridge, .firewall = FirewallAction::Block}),
({
{sfXChainBridge, SoeRequired},
{sfXChainClaimID, SoeRequired},
@@ -489,7 +564,7 @@ TRANSACTION(ttXCHAIN_CLAIM, 43, XChainClaim,
/** This transaction initiates a crosschain account create transaction */
TRANSACTION(ttXCHAIN_ACCOUNT_CREATE_COMMIT, 44, XChainAccountCreateCommit,
({.delegable = Delegation::Delegable, .amendment = featureXChainBridge}),
({.delegable = Delegation::Delegable, .amendment = featureXChainBridge, .firewall = FirewallAction::Block}),
({
{sfXChainBridge, SoeRequired},
{sfDestination, SoeRequired},
@@ -503,6 +578,7 @@ TRANSACTION(ttXCHAIN_ADD_CLAIM_ATTESTATION, 45, XChainAddClaimAttestation,
.delegable = Delegation::Delegable,
.amendment = featureXChainBridge,
.privileges = Privilege::CreateAcct,
.firewall = FirewallAction::Block,
}),
({
{sfXChainBridge, SoeRequired},
@@ -525,6 +601,7 @@ TRANSACTION(ttXCHAIN_ADD_ACCOUNT_CREATE_ATTESTATION, 46, XChainAddAccountCreateA
.delegable = Delegation::Delegable,
.amendment = featureXChainBridge,
.privileges = Privilege::CreateAcct,
.firewall = FirewallAction::Block,
}),
({
{sfXChainBridge, SoeRequired},
@@ -544,7 +621,7 @@ TRANSACTION(ttXCHAIN_ADD_ACCOUNT_CREATE_ATTESTATION, 46, XChainAddAccountCreateA
/** This transaction modifies a sidechain */
TRANSACTION(ttXCHAIN_MODIFY_BRIDGE, 47, XChainModifyBridge,
({.delegable = Delegation::Delegable, .amendment = featureXChainBridge}),
({.delegable = Delegation::Delegable, .amendment = featureXChainBridge, .firewall = FirewallAction::Block}),
({
{sfXChainBridge, SoeRequired},
{sfSignatureReward, SoeOptional},
@@ -553,7 +630,7 @@ TRANSACTION(ttXCHAIN_MODIFY_BRIDGE, 47, XChainModifyBridge,
/** This transactions creates a sidechain */
TRANSACTION(ttXCHAIN_CREATE_BRIDGE, 48, XChainCreateBridge,
({.delegable = Delegation::Delegable, .amendment = featureXChainBridge}),
({.delegable = Delegation::Delegable, .amendment = featureXChainBridge, .firewall = FirewallAction::Block}),
({
{sfXChainBridge, SoeRequired},
{sfSignatureReward, SoeRequired},
@@ -634,6 +711,7 @@ TRANSACTION(ttMPTOKEN_ISSUANCE_CREATE, 54, MPTokenIssuanceCreate,
{sfMPTokenMetadata, SoeOptional},
{sfDomainID, SoeOptional},
{sfImmutableFlags, SoeOptional},
{sfMPTokenSchema, SoeOptional},
}))
/** This transaction type destroys a MPTokensIssuance instance */
@@ -661,6 +739,7 @@ TRANSACTION(ttMPTOKEN_ISSUANCE_SET, 56, MPTokenIssuanceSet,
{sfHolder, SoeOptional},
{sfDomainID, SoeOptional},
{sfMPTokenMetadata, SoeOptional},
{sfMPTokenSchema, SoeOptional},
{sfTransferFee, SoeOptional},
{sfImmutableFlags, SoeOptional},
{sfIssuerEncryptionKey, SoeOptional},
@@ -773,6 +852,7 @@ TRANSACTION(ttVAULT_CREATE, 65, VaultCreate,
.amendment = featureSingleAssetVault,
.privileges = Privilege::CreatePseudoAcct | Privilege::CreateMptIssuance |
Privilege::MustModifyVault,
.firewall = FirewallAction::Block,
}),
({
{sfAsset, SoeRequired, SoeMptSupported},
@@ -785,6 +865,12 @@ TRANSACTION(ttVAULT_CREATE, 65, VaultCreate,
{sfVaultKind, SoeOptional},
{sfSubscriptionDate, SoeOptional},
{sfRedemptionDate, SoeOptional},
{sfDealingInterval, SoeOptional},
{sfDealingWindow, SoeOptional},
{sfDepositFee, SoeOptional},
{sfRedemptionFee, SoeOptional},
{sfRedemptionPeriod, SoeOptional},
{sfAccountingMethod, SoeOptional},
}))
/** This transaction updates a single asset vault. */
@@ -795,12 +881,16 @@ TRANSACTION(ttVAULT_SET, 66, VaultSet,
({
.amendment = featureSingleAssetVault,
.privileges = Privilege::MustModifyVault,
.firewall = FirewallAction::Block,
}),
({
{sfVaultID, SoeRequired},
{sfAssetsMaximum, SoeOptional},
{sfDomainID, SoeOptional},
{sfData, SoeOptional},
{sfDepositFee, SoeOptional},
{sfRedemptionFee, SoeOptional},
{sfRedemptionPeriod, SoeOptional},
}))
/** This transaction deletes a single asset vault. */
@@ -812,6 +902,7 @@ TRANSACTION(ttVAULT_DELETE, 67, VaultDelete,
.amendment = featureSingleAssetVault,
.privileges = Privilege::MustDeleteAcct | Privilege::DestroyMptIssuance |
Privilege::MustModifyVault,
.firewall = FirewallAction::Block,
}),
({
{sfVaultID, SoeRequired},
@@ -826,6 +917,7 @@ TRANSACTION(ttVAULT_DEPOSIT, 68, VaultDeposit,
({
.amendment = featureSingleAssetVault,
.privileges = Privilege::MayAuthorizeMpt | Privilege::MustModifyVault,
.firewall = FirewallAction::Block,
}),
({
{sfVaultID, SoeRequired},
@@ -841,6 +933,7 @@ TRANSACTION(ttVAULT_WITHDRAW, 69, VaultWithdraw,
.amendment = featureSingleAssetVault,
.privileges = Privilege::MayDeleteMpt | Privilege::MayAuthorizeMpt |
Privilege::MustModifyVault,
.firewall = FirewallAction::Block,
}),
({
{sfVaultID, SoeRequired},
@@ -858,6 +951,7 @@ TRANSACTION(ttVAULT_CLAWBACK, 70, VaultClawback,
({
.amendment = featureSingleAssetVault,
.privileges = Privilege::MayDeleteMpt | Privilege::MustModifyVault,
.firewall = FirewallAction::Block,
}),
({
{sfVaultID, SoeRequired},
@@ -888,6 +982,7 @@ TRANSACTION(ttLOAN_BROKER_SET, 74, LoanBrokerSet,
({
.amendment = featureLendingProtocol,
.privileges = Privilege::CreatePseudoAcct | Privilege::MayAuthorizeMpt,
.firewall = FirewallAction::Block,
}),
({
{sfVaultID, SoeRequired},
@@ -907,6 +1002,7 @@ TRANSACTION(ttLOAN_BROKER_DELETE, 75, LoanBrokerDelete,
({
.amendment = featureLendingProtocol,
.privileges = Privilege::MustDeleteAcct | Privilege::MayAuthorizeMpt,
.firewall = FirewallAction::Block,
}),
({
{sfLoanBrokerID, SoeRequired},
@@ -919,6 +1015,7 @@ TRANSACTION(ttLOAN_BROKER_DELETE, 75, LoanBrokerDelete,
TRANSACTION(ttLOAN_BROKER_COVER_DEPOSIT, 76, LoanBrokerCoverDeposit,
({
.amendment = featureLendingProtocol,
.firewall = FirewallAction::Block,
}),
({
{sfLoanBrokerID, SoeRequired},
@@ -933,6 +1030,7 @@ TRANSACTION(ttLOAN_BROKER_COVER_WITHDRAW, 77, LoanBrokerCoverWithdraw,
({
.amendment = featureLendingProtocol,
.privileges = Privilege::MayAuthorizeMpt,
.firewall = FirewallAction::Block,
}),
({
{sfLoanBrokerID, SoeRequired},
@@ -950,6 +1048,7 @@ TRANSACTION(ttLOAN_BROKER_COVER_WITHDRAW, 77, LoanBrokerCoverWithdraw,
TRANSACTION(ttLOAN_BROKER_COVER_CLAWBACK, 78, LoanBrokerCoverClawback,
({
.amendment = featureLendingProtocol,
.firewall = FirewallAction::Block,
}),
({
{sfLoanBrokerID, SoeOptional},
@@ -964,6 +1063,7 @@ TRANSACTION(ttLOAN_SET, 80, LoanSet,
({
.amendment = featureLendingProtocol,
.privileges = Privilege::MayAuthorizeMpt | Privilege::MustModifyVault,
.firewall = FirewallAction::Block,
}),
({
{sfLoanBrokerID, SoeRequired},
@@ -992,6 +1092,7 @@ TRANSACTION(ttLOAN_SET, 80, LoanSet,
TRANSACTION(ttLOAN_DELETE, 81, LoanDelete,
({
.amendment = featureLendingProtocol,
.firewall = FirewallAction::Block,
}),
({
{sfLoanID, SoeRequired},
@@ -1008,6 +1109,7 @@ TRANSACTION(ttLOAN_MANAGE, 82, LoanManage,
// transaction can succeed without options, essentially making it
// a noop.
.privileges = Privilege::MayModifyVault,
.firewall = FirewallAction::Block,
}),
({
{sfLoanID, SoeRequired},
@@ -1021,6 +1123,7 @@ TRANSACTION(ttLOAN_PAY, 84, LoanPay,
({
.amendment = featureLendingProtocol,
.privileges = Privilege::MayAuthorizeMpt | Privilege::MustModifyVault,
.firewall = FirewallAction::Block,
}),
({
{sfLoanID, SoeRequired},
@@ -1034,6 +1137,7 @@ TRANSACTION(ttLOAN_PAY, 84, LoanPay,
TRANSACTION(ttCONFIDENTIAL_MPT_CONVERT, 85, ConfidentialMPTConvert,
({
.amendment = featureConfidentialTransfer,
.firewall = FirewallAction::Block,
}),
({
{sfMPTokenIssuanceID, SoeRequired},
@@ -1051,7 +1155,7 @@ TRANSACTION(ttCONFIDENTIAL_MPT_CONVERT, 85, ConfidentialMPTConvert,
# include <xrpl/tx/transactors/token/ConfidentialMPTMergeInbox.h>
#endif
TRANSACTION(ttCONFIDENTIAL_MPT_MERGE_INBOX, 86, ConfidentialMPTMergeInbox,
({.delegable = Delegation::Delegable, .amendment = featureConfidentialTransfer}),
({.delegable = Delegation::Delegable, .amendment = featureConfidentialTransfer, .firewall = FirewallAction::Check}),
({
{sfMPTokenIssuanceID, SoeRequired},
}))
@@ -1061,7 +1165,7 @@ TRANSACTION(ttCONFIDENTIAL_MPT_MERGE_INBOX, 86, ConfidentialMPTMergeInbox,
# include <xrpl/tx/transactors/token/ConfidentialMPTConvertBack.h>
#endif
TRANSACTION(ttCONFIDENTIAL_MPT_CONVERT_BACK, 87, ConfidentialMPTConvertBack,
({.delegable = Delegation::Delegable, .amendment = featureConfidentialTransfer}),
({.delegable = Delegation::Delegable, .amendment = featureConfidentialTransfer, .firewall = FirewallAction::Block}),
({
{sfMPTokenIssuanceID, SoeRequired},
{sfMPTAmount, SoeRequired},
@@ -1077,7 +1181,7 @@ TRANSACTION(ttCONFIDENTIAL_MPT_CONVERT_BACK, 87, ConfidentialMPTConvertBack,
# include <xrpl/tx/transactors/token/ConfidentialMPTSend.h>
#endif
TRANSACTION(ttCONFIDENTIAL_MPT_SEND, 88, ConfidentialMPTSend,
({.delegable = Delegation::Delegable, .amendment = featureConfidentialTransfer}),
({.delegable = Delegation::Delegable, .amendment = featureConfidentialTransfer, .firewall = FirewallAction::Block}),
({
{sfMPTokenIssuanceID, SoeRequired},
{sfDestination, SoeRequired},
@@ -1111,6 +1215,7 @@ TRANSACTION(ttCONFIDENTIAL_MPT_CLAWBACK, 89, ConfidentialMPTClawback,
TRANSACTION(ttSPONSORSHIP_TRANSFER, 90, SponsorshipTransfer,
({
.amendment = featureSponsor,
.firewall = FirewallAction::Check,
}),
({
{sfObjectID, SoeOptional},
@@ -1161,6 +1266,10 @@ TRANSACTION(ttFEE, 101, SetFee,
{sfBaseFeeDrops, SoeOptional},
{sfReserveBaseDrops, SoeOptional},
{sfReserveIncrementDrops, SoeOptional},
// Smart Escrow fields
{sfGasLimit, SoeOptional},
{sfBytecodeSizeLimit, SoeOptional},
{sfGasPrice, SoeOptional},
}))
/** This system-generated transaction type is used to update the network's negative UNL
@@ -1174,3 +1283,340 @@ TRANSACTION(ttUNL_MODIFY, 102, UNLModify,
{sfLedgerSequence, SoeRequired},
{sfUNLModifyValidator, SoeRequired},
}))
/** This transaction type creates a confidential Ballot. */
#if TRANSACTION_INCLUDE
# include <xrpl/tx/transactors/voting/BallotCreate.h>
#endif
TRANSACTION(ttBALLOT_CREATE, 106, BallotCreate,
({.amendment = featureConfidentialVoting}),
({
{sfMPTokenIssuanceID, SoeOptional},
{sfDomainID, SoeOptional},
{sfDigest, SoeRequired},
{sfURI, SoeOptional},
{sfOptionCount, SoeRequired},
{sfTallyPublicKey, SoeRequired},
{sfAuditorEncryptionKey, SoeOptional},
{sfOpenTime, SoeRequired},
{sfCloseTime, SoeRequired},
{sfZKProof, SoeRequired},
}))
/** This transaction type casts an encrypted vote on a Ballot. */
#if TRANSACTION_INCLUDE
# include <xrpl/tx/transactors/voting/BallotCastVote.h>
#endif
TRANSACTION(ttBALLOT_CAST_VOTE, 107, BallotCastVote,
({.amendment = featureConfidentialVoting}),
({
{sfBallotID, SoeRequired},
{sfEncryptedVotes, SoeRequired},
{sfAuditorEncryptedVotes, SoeOptional},
{sfVoterPublicKey, SoeOptional},
{sfVoterEncryptedVotes, SoeOptional},
{sfZKProof, SoeRequired},
{sfBlindingFactor, SoeRequired},
{sfCredentialIDs, SoeOptional},
}))
/** This transaction type publishes the verifiable results of a Ballot. */
#if TRANSACTION_INCLUDE
# include <xrpl/tx/transactors/voting/BallotFinalize.h>
#endif
TRANSACTION(ttBALLOT_FINALIZE, 108, BallotFinalize,
({.amendment = featureConfidentialVoting}),
({
{sfBallotID, SoeRequired},
{sfResults, SoeRequired},
{sfZKProof, SoeRequired},
}))
/** This transaction type deletes a Ballot or a BallotVote object. */
#if TRANSACTION_INCLUDE
# include <xrpl/tx/transactors/voting/BallotDelete.h>
#endif
TRANSACTION(ttBALLOT_DELETE, 109, BallotDelete,
({.amendment = featureConfidentialVoting}),
({
{sfBallotID, SoeRequired},
}))
/** This transaction claws back tokens locked in a payment channel. */
#if TRANSACTION_INCLUDE
# include <xrpl/tx/transactors/payment_channel/PaymentChannelClawback.h>
#endif
TRANSACTION(ttPAYCHAN_CLAWBACK, 92, PaymentChannelClawback,
({.delegable = Delegation::Delegable, .amendment = featureTokenPaychan}),
({
{sfChannel, SoeRequired},
{sfAmount, SoeOptional, SoeMptSupported},
}))
/** This transaction type sets the passkey list. */
#if TRANSACTION_INCLUDE
# include <xrpl/tx/transactors/account/SetPasskeyList.h>
#endif
TRANSACTION(ttPASSKEY_LIST_SET, 114, PasskeyListSet,
({
.delegable = Delegation::Delegable,
.amendment = featurePasskey,
}),
({
{sfPasskeys, SoeRequired},
}))
/** This transaction sets or updates an account's firewall. */
#if TRANSACTION_INCLUDE
# include <xrpl/tx/transactors/firewall/FirewallSet.h>
#endif
TRANSACTION(ttFIREWALL_SET, 104, FirewallSet,
({.amendment = featureFirewall}),
({
{sfCounterparty, SoeOptional},
{sfBackup, SoeOptional},
{sfMaxFee, SoeOptional},
{sfDestinationTag, SoeOptional},
{sfCounterpartySignature, SoeOptional},
{sfFirewallID, SoeOptional},
}))
/** This transaction deletes an account's firewall. */
#if TRANSACTION_INCLUDE
# include <xrpl/tx/transactors/firewall/FirewallDelete.h>
#endif
TRANSACTION(ttFIREWALL_DELETE, 105, FirewallDelete,
({.amendment = featureFirewall}),
({
{sfCounterpartySignature, SoeRequired},
{sfFirewallID, SoeRequired},
}))
/** This transaction preauthorizes a destination for a firewalled account. */
#if TRANSACTION_INCLUDE
# include <xrpl/tx/transactors/firewall/WithdrawPreauth.h>
#endif
TRANSACTION(ttWITHDRAW_PREAUTH, 103, WithdrawPreauth,
({.amendment = featureFirewall}),
({
{sfAuthorize, SoeOptional},
{sfUnauthorize, SoeOptional},
{sfDestinationTag, SoeOptional},
{sfCounterpartySignature, SoeRequired},
{sfFirewallID, SoeRequired},
}))
/** This transaction type offers a repurchase agreement and locks its collateral. */
#if TRANSACTION_INCLUDE
# include <xrpl/tx/transactors/repo/RepoCreate.h>
#endif
TRANSACTION(ttREPO_CREATE, 115, RepoCreate,
({.delegable = Delegation::Delegable, .amendment = featureRepo}),
({
{sfCounterparty, SoeRequired},
{sfCollateralAmount, SoeRequired, SoeMptSupported},
{sfPurchasePrice, SoeRequired, SoeMptSupported},
{sfInterestRate, SoeRequired},
{sfExpiration, SoeRequired},
{sfMaturityDate, SoeRequired},
{sfGracePeriod, SoeRequired},
{sfData, SoeOptional},
}))
/** This transaction type accepts a pending repo, delivering the cash. */
#if TRANSACTION_INCLUDE
# include <xrpl/tx/transactors/repo/RepoAccept.h>
#endif
TRANSACTION(ttREPO_ACCEPT, 116, RepoAccept,
({.delegable = Delegation::Delegable, .amendment = featureRepo}),
({
{sfRepoID, SoeRequired},
}))
/** This transaction type cancels a pending repo and returns the collateral. */
#if TRANSACTION_INCLUDE
# include <xrpl/tx/transactors/repo/RepoCancel.h>
#endif
TRANSACTION(ttREPO_CANCEL, 117, RepoCancel,
({.delegable = Delegation::Delegable, .amendment = featureRepo}),
({
{sfRepoID, SoeRequired},
}))
/** This transaction type repurchases the collateral, paying principal plus interest. */
#if TRANSACTION_INCLUDE
# include <xrpl/tx/transactors/repo/RepoClose.h>
#endif
TRANSACTION(ttREPO_CLOSE, 118, RepoClose,
({.delegable = Delegation::Delegable, .amendment = featureRepo}),
({
{sfRepoID, SoeRequired},
}))
/** This transaction type closes out a defaulted repo, delivering the collateral. */
#if TRANSACTION_INCLUDE
# include <xrpl/tx/transactors/repo/RepoDefault.h>
#endif
TRANSACTION(ttREPO_DEFAULT, 119, RepoDefault,
({.delegable = Delegation::Delegable, .amendment = featureRepo}),
({
{sfRepoID, SoeRequired},
}))
/** This transaction designates, updates or clears an account's beneficiary. */
#if TRANSACTION_INCLUDE
# include <xrpl/tx/transactors/beneficiary/BeneficiarySet.h>
#endif
TRANSACTION(ttBENEFICIARY_SET, 120, BeneficiarySet,
({.amendment = featureBeneficiary}),
({
{sfBeneficiary, SoeOptional},
{sfTimeLock, SoeOptional},
}))
/** This transaction creates a coupon schedule for a bond asset. */
#if TRANSACTION_INCLUDE
# include <xrpl/tx/transactors/coupon/CouponScheduleCreate.h>
#endif
TRANSACTION(ttCOUPON_SCHEDULE_CREATE, 121, CouponScheduleCreate,
({
.delegable = Delegation::NotDelegable,
.amendment = featureCouponPayments,
}),
({
{sfMPTokenIssuanceID, SoeRequired},
{sfCouponAsset, SoeRequired, SoeMptSupported},
{sfCouponAmount, SoeOptional, SoeMptSupported},
{sfCouponInterval, SoeOptional},
{sfFirstCouponTime, SoeOptional},
{sfExpiration, SoeOptional},
{sfCallNoticePeriod, SoeOptional},
{sfEarliestCallTime, SoeOptional},
}))
/** This transaction exercises the issuer's call option on a callable
coupon schedule by shortening its Expiration. */
#if TRANSACTION_INCLUDE
# include <xrpl/tx/transactors/coupon/CouponScheduleSet.h>
#endif
TRANSACTION(ttCOUPON_SCHEDULE_SET, 93, CouponScheduleSet,
({
.delegable = Delegation::NotDelegable,
.amendment = featureCouponPayments,
}),
({
{sfMPTokenIssuanceID, SoeRequired},
{sfExpiration, SoeRequired},
}))
/** This transaction deletes an empty coupon schedule. */
#if TRANSACTION_INCLUDE
# include <xrpl/tx/transactors/coupon/CouponScheduleDelete.h>
#endif
TRANSACTION(ttCOUPON_SCHEDULE_DELETE, 94, CouponScheduleDelete,
({
.delegable = Delegation::NotDelegable,
.amendment = featureCouponPayments,
}),
({
{sfMPTokenIssuanceID, SoeRequired},
}))
/** This transaction claims settled coupons, delivered from the
schedule's pool. */
#if TRANSACTION_INCLUDE
# include <xrpl/tx/transactors/coupon/CouponClaim.h>
#endif
TRANSACTION(ttCOUPON_CLAIM, 95, CouponClaim,
({
.delegable = Delegation::Delegable,
.amendment = featureCouponPayments,
}),
({
{sfMPTokenIssuanceID, SoeRequired},
{sfAmount, SoeOptional, SoeMptSupported},
}))
/** This transaction declares a coupon: it moves the coupon amount from the
payer's spendable balance into the schedule's pool and advances the
per-unit accumulator. Codes 95 and 96 are retired and not reused. */
#if TRANSACTION_INCLUDE
# include <xrpl/tx/transactors/coupon/CouponPay.h>
#endif
TRANSACTION(ttCOUPON_PAY, 96, CouponPay,
({
.delegable = Delegation::NotDelegable,
.amendment = featureCouponPayments,
}),
({
{sfMPTokenIssuanceID, SoeRequired},
{sfAmount, SoeRequired, SoeMptSupported},
}))
/** This transaction type creates or updates a subscription. */
#if TRANSACTION_INCLUDE
# include <xrpl/tx/transactors/subscription/SubscriptionSet.h>
#endif
TRANSACTION(ttSUBSCRIPTION_SET, 122, SubscriptionSet,
({.delegable = Delegation::Delegable, .amendment = featureSubscription}),
({
{sfDestination, SoeOptional},
{sfAmount, SoeRequired, SoeMptSupported},
{sfFrequency, SoeOptional},
{sfStartTime, SoeOptional},
{sfExpiration, SoeOptional},
{sfDestinationTag, SoeOptional},
{sfSubscriptionID, SoeOptional},
}))
/** This transaction type cancels a subscription. */
#if TRANSACTION_INCLUDE
# include <xrpl/tx/transactors/subscription/SubscriptionCancel.h>
#endif
TRANSACTION(ttSUBSCRIPTION_CANCEL, 123, SubscriptionCancel,
({.delegable = Delegation::Delegable, .amendment = featureSubscription}),
({
{sfSubscriptionID, SoeRequired},
}))
/** This transaction type claims a payment from a subscription. */
#if TRANSACTION_INCLUDE
# include <xrpl/tx/transactors/subscription/SubscriptionClaim.h>
#endif
TRANSACTION(ttSUBSCRIPTION_CLAIM, 124, SubscriptionClaim,
({
.delegable = Delegation::Delegable,
.amendment = featureSubscription,
.privileges = Privilege::MayCreateMpt,
}),
({
{sfAmount, SoeRequired, SoeMptSupported},
{sfSubscriptionID, SoeRequired},
}))
/** This transaction type creates a TokenIssuance object. */
#if TRANSACTION_INCLUDE
# include <xrpl/tx/transactors/token/TokenIssuanceCreate.h>
#endif
TRANSACTION(ttTOKEN_ISSUANCE_CREATE, 125, TokenIssuanceCreate,
({
.amendment = featureTokenIssuance,
.privileges = Privilege::CreateTokenIssuance,
}),
({
{sfCurrency, SoeRequired},
{sfMaximumAmount, SoeOptional},
{sfTokenScale, SoeOptional},
{sfMPTokenIssuanceID, SoeOptional},
{sfTransferFee, SoeOptional},
{sfMPTokenMetadata, SoeOptional},
}))
/** This transaction type modifies a TokenIssuance object. */
#if TRANSACTION_INCLUDE
# include <xrpl/tx/transactors/token/TokenIssuanceSet.h>
#endif
TRANSACTION(ttTOKEN_ISSUANCE_SET, 126, TokenIssuanceSet,
({.amendment = featureTokenIssuance}),
({
{sfCurrency, SoeRequired},
{sfMPTokenIssuanceID, SoeOptional},
{sfTransferFee, SoeOptional},
{sfMPTokenMetadata, SoeOptional},
}))
/** This transaction type destroys a TokenIssuance object. */
#if TRANSACTION_INCLUDE
# include <xrpl/tx/transactors/token/TokenIssuanceDestroy.h>
#endif
TRANSACTION(ttTOKEN_ISSUANCE_DESTROY, 127, TokenIssuanceDestroy,
({
.amendment = featureTokenIssuance,
.privileges = Privilege::DestroyTokenIssuance,
}),
({
{sfCurrency, SoeRequired},
}))
/** This transaction type converts between an IOU and its bound MPT. */
#if TRANSACTION_INCLUDE
# include <xrpl/tx/transactors/token/TokenConvert.h>
#endif
TRANSACTION(ttTOKEN_CONVERT, 128, TokenConvert,
({.amendment = featureTokenIssuance}),
({
{sfAmount, SoeRequired, SoeMptSupported},
}))

View File

@@ -237,4 +237,14 @@ sha512HalfS(Args const&... args)
return static_cast<sha512_half_hasher_s::result_type>(h);
}
template <class... Args>
sha256_hasher::result_type
sha256(Args const&... args)
{
xrpl::sha256_hasher h;
using beast::hash_append;
hash_append(h, args...);
return static_cast<typename sha256_hasher::result_type>(h);
}
} // namespace xrpl

View File

@@ -47,6 +47,7 @@ JSS(Destination); // in: TransactionSign; field.
JSS(EPrice); // in: AMM Deposit option
JSS(Fee); // in/out: TransactionSign; field.
JSS(Flags); // in/out: TransactionSign; field.
JSS(Frequency); // in: Subscription transactions
JSS(Holder); // field.
JSS(Invalid); //
JSS(Issuer); // in: Credential transactions
@@ -81,6 +82,7 @@ JSS(Signer); // field.
JSS(Signers); // field.
JSS(SigningPubKey); // field.
JSS(Subject); // in: Credential transactions
JSS(SubscriptionID); // in: Subscription transactions
JSS(TakerGets); // field.
JSS(TakerPays); // field.
JSS(TradingFee); // in/out: AMM trading fee
@@ -110,14 +112,22 @@ JSS(accounts); // in: LedgerEntry, Subscribe, handlers/Ledger
JSS(accounts_proposed); // in: Subscribe, Unsubscribe
JSS(action); //
JSS(active); // out: OverlayImpl
JSS(active_bin_id); // out: amm_info
JSS(active_liquidity); // out: amm_info, amm_ticks
JSS(actor); // in/out: AccountTx
JSS(acquiring); // out: LedgerRequest
JSS(address); // out: PeerImp
JSS(affected); // out: AcceptedLedgerTx
JSS(age); // out: NetworkOPs, Peers
JSS(all_or_none); // out: NetworkOPs
JSS(alternatives); // out: PathRequest, RipplePathFind
JSS(amendment_blocked); // out: NetworkOPs
JSS(amm_account); // in: amm_info
JSS(amm_id); // in/out: amm_ticks
JSS(amm_ticks); // in: amm_ticks
JSS(amplification); // out: amm_info
JSS(amplification_target); // out: amm_info
JSS(amplification_time); // out: amm_info
JSS(amount); // out: AccountChannels, amm_info
JSS(amount2); // out: amm_info
JSS(api_version); // in: many, out: Version
@@ -145,11 +155,14 @@ JSS(avg_bps_recv); // out: Peers
JSS(avg_bps_sent); // out: Peers
JSS(balance); // out: AccountLines
JSS(balances); // out: GatewayBalances
JSS(ballot_id); // in: LedgerEntry
JSS(base); // out: LogLevel
JSS(base_asset); // in: get_aggregate_price
JSS(base_fee); // out: NetworkOPs
JSS(base_fee_xrp); // out: NetworkOPs
JSS(bids); // out: Subscribe
JSS(bin_count); // out: amm_info
JSS(bin_step); // out: amm_info
JSS(binary); // in: AccountTX, LedgerEntry, AccountTxOld, Tx LedgerData
JSS(blob); // out: ValidatorList
JSS(blobs_v2); // out: ValidatorList
@@ -195,9 +208,12 @@ JSS(cookie); // out: NetworkOPs
JSS(count); // in: AccountTx*, ValidatorList
JSS(counter_party); // in/out: AccountTx
JSS(counters); // in/out: retrieve counters
JSS(coupon_schedule_id); // in: LedgerEntry
JSS(credentials); // in: deposit_authorized
JSS(credential_type); // in: LedgerEntry DepositPreauth
JSS(ctid); // in/out: Tx RPC
JSS(curve_type); // in/out: amm_info, amm_ticks
JSS(current_tick); // out: amm_info, amm_ticks
JSS(currency_a); // out: BookChanges
JSS(currency_b); // out: BookChanges
JSS(currency); // in: paths/PathRequest, STAmount
@@ -258,9 +274,14 @@ JSS(feature); // in: Feature
JSS(features); // out: Feature
JSS(fee_base); // out: NetworkOPs
JSS(fee_div_max); // in: TransactionSign
JSS(fee_growth_global_0); // out: amm_info
JSS(fee_growth_global_1); // out: amm_info
JSS(fee_growth_outside_0); // out: amm_ticks
JSS(fee_growth_outside_1); // out: amm_ticks
JSS(fee_level); // out: AccountInfo
JSS(fee_mult_max); // in: TransactionSign
JSS(fee_ref); // out: NetworkOPs, DEPRECATED
JSS(fee_tier); // out: amm_info
JSS(fetch_pack); // out: NetworkOPs
JSS(FIELDS); // out: RPC server_definitions
// matches definitions.json format
@@ -355,6 +376,8 @@ JSS(limit); // in/out: AccountTx*, AccountOffers, AccountL
// in: LedgerData, BookOffers
JSS(limit_peer); // out: AccountLines
JSS(lines); // out: AccountLines
JSS(liquidity_gross); // out: amm_ticks
JSS(liquidity_net); // out: amm_ticks
JSS(list); // out: ValidatorList
JSS(load); // out: NetworkOPs, PeerImp
JSS(load_base); // out: NetworkOPs
@@ -405,6 +428,7 @@ JSS(methods); //
JSS(metrics); // out: Peers
JSS(min_count); // in: GetCounts
JSS(min_ledger); // in: LedgerCleaner
JSS(min_quantity); // out: NetworkOPs
JSS(minimum_fee); // out: TxQ
JSS(minimum_level); // out: TxQ
JSS(missingCommand); // error
@@ -565,6 +589,7 @@ JSS(source_tag); // out: AccountChannels
JSS(sponsee); // in: LedgerEntry
JSS(sponsor); // in: LedgerEntry
JSS(sponsored); // in: AccountObjects
JSS(sqrt_price_x96); // out: amm_info, amm_ticks
JSS(stand_alone); // out: NetworkOPs
JSS(standard_deviation); // out: get_aggregate_price
JSS(start); // in: TxHistory
@@ -592,6 +617,11 @@ JSS(taker_pays_funded); // out: NetworkOPs
JSS(threshold); // in: Blacklist
JSS(ticket_count); // out: AccountInfo
JSS(ticket_seq); // in: LedgerEntry
JSS(tick_index); // out: amm_ticks
JSS(tick_lower); // in: amm_ticks
JSS(tick_spacing); // out: amm_info
JSS(tick_upper); // in: amm_ticks
JSS(ticks); // out: amm_ticks
JSS(time); //
JSS(timeouts); // out: InboundLedger
JSS(time_threshold); // in/out: Oracle aggregate

View File

@@ -221,6 +221,318 @@ public:
{
return this->sle_->isFieldPresent(sfPreviousTxnLgrSeq);
}
/**
* @brief Get sfCurveType (SoeDefault)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
protocol_autogen::Optional<SF_UINT8::type::value_type>
getCurveType() const
{
if (hasCurveType())
return this->sle_->at(sfCurveType);
return std::nullopt;
}
/**
* @brief Check if sfCurveType is present.
* @return True if the field is present, false otherwise.
*/
[[nodiscard]]
bool
hasCurveType() const
{
return this->sle_->isFieldPresent(sfCurveType);
}
/**
* @brief Get sfFeeTier (SoeOptional)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
protocol_autogen::Optional<SF_UINT8::type::value_type>
getFeeTier() const
{
if (hasFeeTier())
return this->sle_->at(sfFeeTier);
return std::nullopt;
}
/**
* @brief Check if sfFeeTier is present.
* @return True if the field is present, false otherwise.
*/
[[nodiscard]]
bool
hasFeeTier() const
{
return this->sle_->isFieldPresent(sfFeeTier);
}
/**
* @brief Get sfTickSpacing (SoeOptional)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
protocol_autogen::Optional<SF_UINT16::type::value_type>
getTickSpacing() const
{
if (hasTickSpacing())
return this->sle_->at(sfTickSpacing);
return std::nullopt;
}
/**
* @brief Check if sfTickSpacing is present.
* @return True if the field is present, false otherwise.
*/
[[nodiscard]]
bool
hasTickSpacing() const
{
return this->sle_->isFieldPresent(sfTickSpacing);
}
/**
* @brief Get sfCurrentTick (SoeOptional)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
protocol_autogen::Optional<SF_INT32::type::value_type>
getCurrentTick() const
{
if (hasCurrentTick())
return this->sle_->at(sfCurrentTick);
return std::nullopt;
}
/**
* @brief Check if sfCurrentTick is present.
* @return True if the field is present, false otherwise.
*/
[[nodiscard]]
bool
hasCurrentTick() const
{
return this->sle_->isFieldPresent(sfCurrentTick);
}
/**
* @brief Get sfActiveLiquidity (SoeOptional)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
protocol_autogen::Optional<SF_UINT64::type::value_type>
getActiveLiquidity() const
{
if (hasActiveLiquidity())
return this->sle_->at(sfActiveLiquidity);
return std::nullopt;
}
/**
* @brief Check if sfActiveLiquidity is present.
* @return True if the field is present, false otherwise.
*/
[[nodiscard]]
bool
hasActiveLiquidity() const
{
return this->sle_->isFieldPresent(sfActiveLiquidity);
}
/**
* @brief Get sfSqrtPriceX96 (SoeOptional)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
protocol_autogen::Optional<SF_UINT256::type::value_type>
getSqrtPriceX96() const
{
if (hasSqrtPriceX96())
return this->sle_->at(sfSqrtPriceX96);
return std::nullopt;
}
/**
* @brief Check if sfSqrtPriceX96 is present.
* @return True if the field is present, false otherwise.
*/
[[nodiscard]]
bool
hasSqrtPriceX96() const
{
return this->sle_->isFieldPresent(sfSqrtPriceX96);
}
/**
* @brief Get sfFeeGrowthGlobal0 (SoeOptional)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
protocol_autogen::Optional<SF_NUMBER::type::value_type>
getFeeGrowthGlobal0() const
{
if (hasFeeGrowthGlobal0())
return this->sle_->at(sfFeeGrowthGlobal0);
return std::nullopt;
}
/**
* @brief Check if sfFeeGrowthGlobal0 is present.
* @return True if the field is present, false otherwise.
*/
[[nodiscard]]
bool
hasFeeGrowthGlobal0() const
{
return this->sle_->isFieldPresent(sfFeeGrowthGlobal0);
}
/**
* @brief Get sfFeeGrowthGlobal1 (SoeOptional)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
protocol_autogen::Optional<SF_NUMBER::type::value_type>
getFeeGrowthGlobal1() const
{
if (hasFeeGrowthGlobal1())
return this->sle_->at(sfFeeGrowthGlobal1);
return std::nullopt;
}
/**
* @brief Check if sfFeeGrowthGlobal1 is present.
* @return True if the field is present, false otherwise.
*/
[[nodiscard]]
bool
hasFeeGrowthGlobal1() const
{
return this->sle_->isFieldPresent(sfFeeGrowthGlobal1);
}
/**
* @brief Get sfAmplification (SoeOptional)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
protocol_autogen::Optional<SF_UINT32::type::value_type>
getAmplification() const
{
if (hasAmplification())
return this->sle_->at(sfAmplification);
return std::nullopt;
}
/**
* @brief Check if sfAmplification is present.
* @return True if the field is present, false otherwise.
*/
[[nodiscard]]
bool
hasAmplification() const
{
return this->sle_->isFieldPresent(sfAmplification);
}
/**
* @brief Get sfAmplificationTime (SoeOptional)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
protocol_autogen::Optional<SF_UINT32::type::value_type>
getAmplificationTime() const
{
if (hasAmplificationTime())
return this->sle_->at(sfAmplificationTime);
return std::nullopt;
}
/**
* @brief Check if sfAmplificationTime is present.
* @return True if the field is present, false otherwise.
*/
[[nodiscard]]
bool
hasAmplificationTime() const
{
return this->sle_->isFieldPresent(sfAmplificationTime);
}
/**
* @brief Get sfPositionCount (SoeDefault)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
protocol_autogen::Optional<SF_UINT32::type::value_type>
getPositionCount() const
{
if (hasPositionCount())
return this->sle_->at(sfPositionCount);
return std::nullopt;
}
/**
* @brief Check if sfPositionCount is present.
* @return True if the field is present, false otherwise.
*/
[[nodiscard]]
bool
hasPositionCount() const
{
return this->sle_->isFieldPresent(sfPositionCount);
}
/**
* @brief Get sfBinStep (SoeOptional)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
protocol_autogen::Optional<SF_UINT16::type::value_type>
getBinStep() const
{
if (hasBinStep())
return this->sle_->at(sfBinStep);
return std::nullopt;
}
/**
* @brief Check if sfBinStep is present.
* @return True if the field is present, false otherwise.
*/
[[nodiscard]]
bool
hasBinStep() const
{
return this->sle_->isFieldPresent(sfBinStep);
}
/**
* @brief Get sfActiveBinID (SoeOptional)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
protocol_autogen::Optional<SF_INT32::type::value_type>
getActiveBinID() const
{
if (hasActiveBinID())
return this->sle_->at(sfActiveBinID);
return std::nullopt;
}
/**
* @brief Check if sfActiveBinID is present.
* @return True if the field is present, false otherwise.
*/
[[nodiscard]]
bool
hasActiveBinID() const
{
return this->sle_->isFieldPresent(sfActiveBinID);
}
};
/**
@@ -379,6 +691,149 @@ public:
return *this;
}
/**
* @brief Set sfCurveType (SoeDefault)
* @return Reference to this builder for method chaining.
*/
AMMBuilder&
setCurveType(std::decay_t<typename SF_UINT8::type::value_type> const& value)
{
object_[sfCurveType] = value;
return *this;
}
/**
* @brief Set sfFeeTier (SoeOptional)
* @return Reference to this builder for method chaining.
*/
AMMBuilder&
setFeeTier(std::decay_t<typename SF_UINT8::type::value_type> const& value)
{
object_[sfFeeTier] = value;
return *this;
}
/**
* @brief Set sfTickSpacing (SoeOptional)
* @return Reference to this builder for method chaining.
*/
AMMBuilder&
setTickSpacing(std::decay_t<typename SF_UINT16::type::value_type> const& value)
{
object_[sfTickSpacing] = value;
return *this;
}
/**
* @brief Set sfCurrentTick (SoeOptional)
* @return Reference to this builder for method chaining.
*/
AMMBuilder&
setCurrentTick(std::decay_t<typename SF_INT32::type::value_type> const& value)
{
object_[sfCurrentTick] = value;
return *this;
}
/**
* @brief Set sfActiveLiquidity (SoeOptional)
* @return Reference to this builder for method chaining.
*/
AMMBuilder&
setActiveLiquidity(std::decay_t<typename SF_UINT64::type::value_type> const& value)
{
object_[sfActiveLiquidity] = value;
return *this;
}
/**
* @brief Set sfSqrtPriceX96 (SoeOptional)
* @return Reference to this builder for method chaining.
*/
AMMBuilder&
setSqrtPriceX96(std::decay_t<typename SF_UINT256::type::value_type> const& value)
{
object_[sfSqrtPriceX96] = value;
return *this;
}
/**
* @brief Set sfFeeGrowthGlobal0 (SoeOptional)
* @return Reference to this builder for method chaining.
*/
AMMBuilder&
setFeeGrowthGlobal0(std::decay_t<typename SF_NUMBER::type::value_type> const& value)
{
object_[sfFeeGrowthGlobal0] = value;
return *this;
}
/**
* @brief Set sfFeeGrowthGlobal1 (SoeOptional)
* @return Reference to this builder for method chaining.
*/
AMMBuilder&
setFeeGrowthGlobal1(std::decay_t<typename SF_NUMBER::type::value_type> const& value)
{
object_[sfFeeGrowthGlobal1] = value;
return *this;
}
/**
* @brief Set sfAmplification (SoeOptional)
* @return Reference to this builder for method chaining.
*/
AMMBuilder&
setAmplification(std::decay_t<typename SF_UINT32::type::value_type> const& value)
{
object_[sfAmplification] = value;
return *this;
}
/**
* @brief Set sfAmplificationTime (SoeOptional)
* @return Reference to this builder for method chaining.
*/
AMMBuilder&
setAmplificationTime(std::decay_t<typename SF_UINT32::type::value_type> const& value)
{
object_[sfAmplificationTime] = value;
return *this;
}
/**
* @brief Set sfPositionCount (SoeDefault)
* @return Reference to this builder for method chaining.
*/
AMMBuilder&
setPositionCount(std::decay_t<typename SF_UINT32::type::value_type> const& value)
{
object_[sfPositionCount] = value;
return *this;
}
/**
* @brief Set sfBinStep (SoeOptional)
* @return Reference to this builder for method chaining.
*/
AMMBuilder&
setBinStep(std::decay_t<typename SF_UINT16::type::value_type> const& value)
{
object_[sfBinStep] = value;
return *this;
}
/**
* @brief Set sfActiveBinID (SoeOptional)
* @return Reference to this builder for method chaining.
*/
AMMBuilder&
setActiveBinID(std::decay_t<typename SF_INT32::type::value_type> const& value)
{
object_[sfActiveBinID] = value;
return *this;
}
/**
* @brief Build and return the completed AMM wrapper.
* @param index The ledger entry index.

View File

@@ -0,0 +1,324 @@
// 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/LedgerEntryBase.h>
#include <xrpl/protocol_autogen/LedgerEntryBuilderBase.h>
#include <xrpl/json/json_value.h>
#include <stdexcept>
#include <optional>
namespace xrpl::ledger_entries {
class AMMBinBuilder;
/**
* @brief Ledger Entry: AMMBin
*
* Type: ltAMM_BIN (0x0093)
* RPC Name: amm_bin
*
* Immutable wrapper around SLE providing type-safe field access.
* Use AMMBinBuilder to construct new ledger entries.
*/
class AMMBin : public LedgerEntryBase
{
public:
static constexpr LedgerEntryType entryType = ltAMM_BIN;
/**
* @brief Construct a AMMBin ledger entry wrapper from an existing SLE object.
* @throws std::runtime_error if the ledger entry type doesn't match.
*/
explicit AMMBin(SLE::const_pointer sle)
: LedgerEntryBase(std::move(sle))
{
// Verify ledger entry type
if (sle_->getType() != entryType)
{
throw std::runtime_error("Invalid ledger entry type for AMMBin");
}
}
// Ledger entry-specific field getters
/**
* @brief Get sfAMMID (SoeRequired)
* @return The field value.
*/
[[nodiscard]]
SF_UINT256::type::value_type
getAMMID() const
{
return this->sle_->at(sfAMMID);
}
/**
* @brief Get sfBinID (SoeRequired)
* @return The field value.
*/
[[nodiscard]]
SF_INT32::type::value_type
getBinID() const
{
return this->sle_->at(sfBinID);
}
/**
* @brief Get sfReserve0 (SoeRequired)
* @return The field value.
*/
[[nodiscard]]
SF_AMOUNT::type::value_type
getReserve0() const
{
return this->sle_->at(sfReserve0);
}
/**
* @brief Get sfReserve1 (SoeRequired)
* @return The field value.
*/
[[nodiscard]]
SF_AMOUNT::type::value_type
getReserve1() const
{
return this->sle_->at(sfReserve1);
}
/**
* @brief Get sfFeeGrowthBin0 (SoeRequired)
* @return The field value.
*/
[[nodiscard]]
SF_NUMBER::type::value_type
getFeeGrowthBin0() const
{
return this->sle_->at(sfFeeGrowthBin0);
}
/**
* @brief Get sfFeeGrowthBin1 (SoeRequired)
* @return The field value.
*/
[[nodiscard]]
SF_NUMBER::type::value_type
getFeeGrowthBin1() const
{
return this->sle_->at(sfFeeGrowthBin1);
}
/**
* @brief Get sfOutstandingAmount (SoeRequired)
* @return The field value.
*/
[[nodiscard]]
SF_UINT64::type::value_type
getOutstandingAmount() const
{
return this->sle_->at(sfOutstandingAmount);
}
/**
* @brief Get sfMPTokenIssuanceID (SoeOptional)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
protocol_autogen::Optional<SF_UINT192::type::value_type>
getMPTokenIssuanceID() const
{
if (hasMPTokenIssuanceID())
return this->sle_->at(sfMPTokenIssuanceID);
return std::nullopt;
}
/**
* @brief Check if sfMPTokenIssuanceID is present.
* @return True if the field is present, false otherwise.
*/
[[nodiscard]]
bool
hasMPTokenIssuanceID() const
{
return this->sle_->isFieldPresent(sfMPTokenIssuanceID);
}
/**
* @brief Get sfOwnerNode (SoeRequired)
* @return The field value.
*/
[[nodiscard]]
SF_UINT64::type::value_type
getOwnerNode() const
{
return this->sle_->at(sfOwnerNode);
}
};
/**
* @brief Builder for AMMBin ledger entries.
*
* Provides a fluent interface for constructing ledger entries with method chaining.
* Uses STObject internally for flexible ledger entry construction.
* Inherits common field setters from LedgerEntryBuilderBase.
*/
class AMMBinBuilder : public LedgerEntryBuilderBase<AMMBinBuilder>
{
public:
/**
* @brief Construct a new AMMBinBuilder with required fields.
* @param aMMID The sfAMMID field value.
* @param binID The sfBinID field value.
* @param reserve0 The sfReserve0 field value.
* @param reserve1 The sfReserve1 field value.
* @param feeGrowthBin0 The sfFeeGrowthBin0 field value.
* @param feeGrowthBin1 The sfFeeGrowthBin1 field value.
* @param outstandingAmount The sfOutstandingAmount field value.
* @param ownerNode The sfOwnerNode field value.
*/
AMMBinBuilder(std::decay_t<typename SF_UINT256::type::value_type> const& aMMID,std::decay_t<typename SF_INT32::type::value_type> const& binID,std::decay_t<typename SF_AMOUNT::type::value_type> const& reserve0,std::decay_t<typename SF_AMOUNT::type::value_type> const& reserve1,std::decay_t<typename SF_NUMBER::type::value_type> const& feeGrowthBin0,std::decay_t<typename SF_NUMBER::type::value_type> const& feeGrowthBin1,std::decay_t<typename SF_UINT64::type::value_type> const& outstandingAmount,std::decay_t<typename SF_UINT64::type::value_type> const& ownerNode)
: LedgerEntryBuilderBase<AMMBinBuilder>(ltAMM_BIN)
{
setAMMID(aMMID);
setBinID(binID);
setReserve0(reserve0);
setReserve1(reserve1);
setFeeGrowthBin0(feeGrowthBin0);
setFeeGrowthBin1(feeGrowthBin1);
setOutstandingAmount(outstandingAmount);
setOwnerNode(ownerNode);
}
/**
* @brief Construct a AMMBinBuilder from an existing SLE object.
* @param sle The existing ledger entry to copy from.
* @throws std::runtime_error if the ledger entry type doesn't match.
*/
AMMBinBuilder(SLE::const_pointer sle)
{
if (sle->at(sfLedgerEntryType) != ltAMM_BIN)
{
throw std::runtime_error("Invalid ledger entry type for AMMBin");
}
object_ = *sle;
}
/**
* @brief Ledger entry-specific field setters
*/
/**
* @brief Set sfAMMID (SoeRequired)
* @return Reference to this builder for method chaining.
*/
AMMBinBuilder&
setAMMID(std::decay_t<typename SF_UINT256::type::value_type> const& value)
{
object_[sfAMMID] = value;
return *this;
}
/**
* @brief Set sfBinID (SoeRequired)
* @return Reference to this builder for method chaining.
*/
AMMBinBuilder&
setBinID(std::decay_t<typename SF_INT32::type::value_type> const& value)
{
object_[sfBinID] = value;
return *this;
}
/**
* @brief Set sfReserve0 (SoeRequired)
* @return Reference to this builder for method chaining.
*/
AMMBinBuilder&
setReserve0(std::decay_t<typename SF_AMOUNT::type::value_type> const& value)
{
object_[sfReserve0] = value;
return *this;
}
/**
* @brief Set sfReserve1 (SoeRequired)
* @return Reference to this builder for method chaining.
*/
AMMBinBuilder&
setReserve1(std::decay_t<typename SF_AMOUNT::type::value_type> const& value)
{
object_[sfReserve1] = value;
return *this;
}
/**
* @brief Set sfFeeGrowthBin0 (SoeRequired)
* @return Reference to this builder for method chaining.
*/
AMMBinBuilder&
setFeeGrowthBin0(std::decay_t<typename SF_NUMBER::type::value_type> const& value)
{
object_[sfFeeGrowthBin0] = value;
return *this;
}
/**
* @brief Set sfFeeGrowthBin1 (SoeRequired)
* @return Reference to this builder for method chaining.
*/
AMMBinBuilder&
setFeeGrowthBin1(std::decay_t<typename SF_NUMBER::type::value_type> const& value)
{
object_[sfFeeGrowthBin1] = value;
return *this;
}
/**
* @brief Set sfOutstandingAmount (SoeRequired)
* @return Reference to this builder for method chaining.
*/
AMMBinBuilder&
setOutstandingAmount(std::decay_t<typename SF_UINT64::type::value_type> const& value)
{
object_[sfOutstandingAmount] = value;
return *this;
}
/**
* @brief Set sfMPTokenIssuanceID (SoeOptional)
* @return Reference to this builder for method chaining.
*/
AMMBinBuilder&
setMPTokenIssuanceID(std::decay_t<typename SF_UINT192::type::value_type> const& value)
{
object_[sfMPTokenIssuanceID] = value;
return *this;
}
/**
* @brief Set sfOwnerNode (SoeRequired)
* @return Reference to this builder for method chaining.
*/
AMMBinBuilder&
setOwnerNode(std::decay_t<typename SF_UINT64::type::value_type> const& value)
{
object_[sfOwnerNode] = value;
return *this;
}
/**
* @brief Build and return the completed AMMBin wrapper.
* @param index The ledger entry index.
* @return The constructed ledger entry wrapper.
*/
AMMBin
build(uint256 const& index)
{
return AMMBin{std::make_shared<SLE>(std::move(object_), index)};
}
};
} // namespace xrpl::ledger_entries

View File

@@ -0,0 +1,241 @@
// 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/LedgerEntryBase.h>
#include <xrpl/protocol_autogen/LedgerEntryBuilderBase.h>
#include <xrpl/json/json_value.h>
#include <stdexcept>
#include <optional>
namespace xrpl::ledger_entries {
class AMMBinHoldingBuilder;
/**
* @brief Ledger Entry: AMMBinHolding
*
* Type: ltAMM_BIN_HOLDING (0x0094)
* RPC Name: amm_bin_holding
*
* Immutable wrapper around SLE providing type-safe field access.
* Use AMMBinHoldingBuilder to construct new ledger entries.
*/
class AMMBinHolding : public LedgerEntryBase
{
public:
static constexpr LedgerEntryType entryType = ltAMM_BIN_HOLDING;
/**
* @brief Construct a AMMBinHolding ledger entry wrapper from an existing SLE object.
* @throws std::runtime_error if the ledger entry type doesn't match.
*/
explicit AMMBinHolding(SLE::const_pointer sle)
: LedgerEntryBase(std::move(sle))
{
// Verify ledger entry type
if (sle_->getType() != entryType)
{
throw std::runtime_error("Invalid ledger entry type for AMMBinHolding");
}
}
// Ledger entry-specific field getters
/**
* @brief Get sfAccount (SoeRequired)
* @return The field value.
*/
[[nodiscard]]
SF_ACCOUNT::type::value_type
getAccount() const
{
return this->sle_->at(sfAccount);
}
/**
* @brief Get sfAMMID (SoeRequired)
* @return The field value.
*/
[[nodiscard]]
SF_UINT256::type::value_type
getAMMID() const
{
return this->sle_->at(sfAMMID);
}
/**
* @brief Get sfBinID (SoeRequired)
* @return The field value.
*/
[[nodiscard]]
SF_INT32::type::value_type
getBinID() const
{
return this->sle_->at(sfBinID);
}
/**
* @brief Get sfFeeGrowthInsideLast0 (SoeRequired)
* @return The field value.
*/
[[nodiscard]]
SF_NUMBER::type::value_type
getFeeGrowthInsideLast0() const
{
return this->sle_->at(sfFeeGrowthInsideLast0);
}
/**
* @brief Get sfFeeGrowthInsideLast1 (SoeRequired)
* @return The field value.
*/
[[nodiscard]]
SF_NUMBER::type::value_type
getFeeGrowthInsideLast1() const
{
return this->sle_->at(sfFeeGrowthInsideLast1);
}
/**
* @brief Get sfOwnerNode (SoeRequired)
* @return The field value.
*/
[[nodiscard]]
SF_UINT64::type::value_type
getOwnerNode() const
{
return this->sle_->at(sfOwnerNode);
}
};
/**
* @brief Builder for AMMBinHolding ledger entries.
*
* Provides a fluent interface for constructing ledger entries with method chaining.
* Uses STObject internally for flexible ledger entry construction.
* Inherits common field setters from LedgerEntryBuilderBase.
*/
class AMMBinHoldingBuilder : public LedgerEntryBuilderBase<AMMBinHoldingBuilder>
{
public:
/**
* @brief Construct a new AMMBinHoldingBuilder with required fields.
* @param account The sfAccount field value.
* @param aMMID The sfAMMID field value.
* @param binID The sfBinID field value.
* @param feeGrowthInsideLast0 The sfFeeGrowthInsideLast0 field value.
* @param feeGrowthInsideLast1 The sfFeeGrowthInsideLast1 field value.
* @param ownerNode The sfOwnerNode field value.
*/
AMMBinHoldingBuilder(std::decay_t<typename SF_ACCOUNT::type::value_type> const& account,std::decay_t<typename SF_UINT256::type::value_type> const& aMMID,std::decay_t<typename SF_INT32::type::value_type> const& binID,std::decay_t<typename SF_NUMBER::type::value_type> const& feeGrowthInsideLast0,std::decay_t<typename SF_NUMBER::type::value_type> const& feeGrowthInsideLast1,std::decay_t<typename SF_UINT64::type::value_type> const& ownerNode)
: LedgerEntryBuilderBase<AMMBinHoldingBuilder>(ltAMM_BIN_HOLDING)
{
setAccount(account);
setAMMID(aMMID);
setBinID(binID);
setFeeGrowthInsideLast0(feeGrowthInsideLast0);
setFeeGrowthInsideLast1(feeGrowthInsideLast1);
setOwnerNode(ownerNode);
}
/**
* @brief Construct a AMMBinHoldingBuilder from an existing SLE object.
* @param sle The existing ledger entry to copy from.
* @throws std::runtime_error if the ledger entry type doesn't match.
*/
AMMBinHoldingBuilder(SLE::const_pointer sle)
{
if (sle->at(sfLedgerEntryType) != ltAMM_BIN_HOLDING)
{
throw std::runtime_error("Invalid ledger entry type for AMMBinHolding");
}
object_ = *sle;
}
/**
* @brief Ledger entry-specific field setters
*/
/**
* @brief Set sfAccount (SoeRequired)
* @return Reference to this builder for method chaining.
*/
AMMBinHoldingBuilder&
setAccount(std::decay_t<typename SF_ACCOUNT::type::value_type> const& value)
{
object_[sfAccount] = value;
return *this;
}
/**
* @brief Set sfAMMID (SoeRequired)
* @return Reference to this builder for method chaining.
*/
AMMBinHoldingBuilder&
setAMMID(std::decay_t<typename SF_UINT256::type::value_type> const& value)
{
object_[sfAMMID] = value;
return *this;
}
/**
* @brief Set sfBinID (SoeRequired)
* @return Reference to this builder for method chaining.
*/
AMMBinHoldingBuilder&
setBinID(std::decay_t<typename SF_INT32::type::value_type> const& value)
{
object_[sfBinID] = value;
return *this;
}
/**
* @brief Set sfFeeGrowthInsideLast0 (SoeRequired)
* @return Reference to this builder for method chaining.
*/
AMMBinHoldingBuilder&
setFeeGrowthInsideLast0(std::decay_t<typename SF_NUMBER::type::value_type> const& value)
{
object_[sfFeeGrowthInsideLast0] = value;
return *this;
}
/**
* @brief Set sfFeeGrowthInsideLast1 (SoeRequired)
* @return Reference to this builder for method chaining.
*/
AMMBinHoldingBuilder&
setFeeGrowthInsideLast1(std::decay_t<typename SF_NUMBER::type::value_type> const& value)
{
object_[sfFeeGrowthInsideLast1] = value;
return *this;
}
/**
* @brief Set sfOwnerNode (SoeRequired)
* @return Reference to this builder for method chaining.
*/
AMMBinHoldingBuilder&
setOwnerNode(std::decay_t<typename SF_UINT64::type::value_type> const& value)
{
object_[sfOwnerNode] = value;
return *this;
}
/**
* @brief Build and return the completed AMMBinHolding wrapper.
* @param index The ledger entry index.
* @return The constructed ledger entry wrapper.
*/
AMMBinHolding
build(uint256 const& index)
{
return AMMBinHolding{std::make_shared<SLE>(std::move(object_), index)};
}
};
} // namespace xrpl::ledger_entries

View File

@@ -0,0 +1,359 @@
// 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/LedgerEntryBase.h>
#include <xrpl/protocol_autogen/LedgerEntryBuilderBase.h>
#include <xrpl/json/json_value.h>
#include <stdexcept>
#include <optional>
namespace xrpl::ledger_entries {
class AMMPositionBuilder;
/**
* @brief Ledger Entry: AMMPosition
*
* Type: ltAMM_POSITION (0x007a)
* RPC Name: amm_position
*
* Immutable wrapper around SLE providing type-safe field access.
* Use AMMPositionBuilder to construct new ledger entries.
*/
class AMMPosition : public LedgerEntryBase
{
public:
static constexpr LedgerEntryType entryType = ltAMM_POSITION;
/**
* @brief Construct a AMMPosition ledger entry wrapper from an existing SLE object.
* @throws std::runtime_error if the ledger entry type doesn't match.
*/
explicit AMMPosition(SLE::const_pointer sle)
: LedgerEntryBase(std::move(sle))
{
// Verify ledger entry type
if (sle_->getType() != entryType)
{
throw std::runtime_error("Invalid ledger entry type for AMMPosition");
}
}
// Ledger entry-specific field getters
/**
* @brief Get sfAccount (SoeRequired)
* @return The field value.
*/
[[nodiscard]]
SF_ACCOUNT::type::value_type
getAccount() const
{
return this->sle_->at(sfAccount);
}
/**
* @brief Get sfAMMID (SoeRequired)
* @return The field value.
*/
[[nodiscard]]
SF_UINT256::type::value_type
getAMMID() const
{
return this->sle_->at(sfAMMID);
}
/**
* @brief Get sfTickLower (SoeRequired)
* @return The field value.
*/
[[nodiscard]]
SF_INT32::type::value_type
getTickLower() const
{
return this->sle_->at(sfTickLower);
}
/**
* @brief Get sfTickUpper (SoeRequired)
* @return The field value.
*/
[[nodiscard]]
SF_INT32::type::value_type
getTickUpper() const
{
return this->sle_->at(sfTickUpper);
}
/**
* @brief Get sfPositionLiquidity (SoeRequired)
* @return The field value.
*/
[[nodiscard]]
SF_UINT64::type::value_type
getPositionLiquidity() const
{
return this->sle_->at(sfPositionLiquidity);
}
/**
* @brief Get sfFeeGrowthInsideLast0 (SoeRequired)
* @return The field value.
*/
[[nodiscard]]
SF_NUMBER::type::value_type
getFeeGrowthInsideLast0() const
{
return this->sle_->at(sfFeeGrowthInsideLast0);
}
/**
* @brief Get sfFeeGrowthInsideLast1 (SoeRequired)
* @return The field value.
*/
[[nodiscard]]
SF_NUMBER::type::value_type
getFeeGrowthInsideLast1() const
{
return this->sle_->at(sfFeeGrowthInsideLast1);
}
/**
* @brief Get sfTokensOwed0 (SoeDefault)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
protocol_autogen::Optional<SF_AMOUNT::type::value_type>
getTokensOwed0() const
{
if (hasTokensOwed0())
return this->sle_->at(sfTokensOwed0);
return std::nullopt;
}
/**
* @brief Check if sfTokensOwed0 is present.
* @return True if the field is present, false otherwise.
*/
[[nodiscard]]
bool
hasTokensOwed0() const
{
return this->sle_->isFieldPresent(sfTokensOwed0);
}
/**
* @brief Get sfTokensOwed1 (SoeDefault)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
protocol_autogen::Optional<SF_AMOUNT::type::value_type>
getTokensOwed1() const
{
if (hasTokensOwed1())
return this->sle_->at(sfTokensOwed1);
return std::nullopt;
}
/**
* @brief Check if sfTokensOwed1 is present.
* @return True if the field is present, false otherwise.
*/
[[nodiscard]]
bool
hasTokensOwed1() const
{
return this->sle_->isFieldPresent(sfTokensOwed1);
}
/**
* @brief Get sfOwnerNode (SoeRequired)
* @return The field value.
*/
[[nodiscard]]
SF_UINT64::type::value_type
getOwnerNode() const
{
return this->sle_->at(sfOwnerNode);
}
};
/**
* @brief Builder for AMMPosition ledger entries.
*
* Provides a fluent interface for constructing ledger entries with method chaining.
* Uses STObject internally for flexible ledger entry construction.
* Inherits common field setters from LedgerEntryBuilderBase.
*/
class AMMPositionBuilder : public LedgerEntryBuilderBase<AMMPositionBuilder>
{
public:
/**
* @brief Construct a new AMMPositionBuilder with required fields.
* @param account The sfAccount field value.
* @param aMMID The sfAMMID field value.
* @param tickLower The sfTickLower field value.
* @param tickUpper The sfTickUpper field value.
* @param positionLiquidity The sfPositionLiquidity field value.
* @param feeGrowthInsideLast0 The sfFeeGrowthInsideLast0 field value.
* @param feeGrowthInsideLast1 The sfFeeGrowthInsideLast1 field value.
* @param ownerNode The sfOwnerNode field value.
*/
AMMPositionBuilder(std::decay_t<typename SF_ACCOUNT::type::value_type> const& account,std::decay_t<typename SF_UINT256::type::value_type> const& aMMID,std::decay_t<typename SF_INT32::type::value_type> const& tickLower,std::decay_t<typename SF_INT32::type::value_type> const& tickUpper,std::decay_t<typename SF_UINT64::type::value_type> const& positionLiquidity,std::decay_t<typename SF_NUMBER::type::value_type> const& feeGrowthInsideLast0,std::decay_t<typename SF_NUMBER::type::value_type> const& feeGrowthInsideLast1,std::decay_t<typename SF_UINT64::type::value_type> const& ownerNode)
: LedgerEntryBuilderBase<AMMPositionBuilder>(ltAMM_POSITION)
{
setAccount(account);
setAMMID(aMMID);
setTickLower(tickLower);
setTickUpper(tickUpper);
setPositionLiquidity(positionLiquidity);
setFeeGrowthInsideLast0(feeGrowthInsideLast0);
setFeeGrowthInsideLast1(feeGrowthInsideLast1);
setOwnerNode(ownerNode);
}
/**
* @brief Construct a AMMPositionBuilder from an existing SLE object.
* @param sle The existing ledger entry to copy from.
* @throws std::runtime_error if the ledger entry type doesn't match.
*/
AMMPositionBuilder(SLE::const_pointer sle)
{
if (sle->at(sfLedgerEntryType) != ltAMM_POSITION)
{
throw std::runtime_error("Invalid ledger entry type for AMMPosition");
}
object_ = *sle;
}
/**
* @brief Ledger entry-specific field setters
*/
/**
* @brief Set sfAccount (SoeRequired)
* @return Reference to this builder for method chaining.
*/
AMMPositionBuilder&
setAccount(std::decay_t<typename SF_ACCOUNT::type::value_type> const& value)
{
object_[sfAccount] = value;
return *this;
}
/**
* @brief Set sfAMMID (SoeRequired)
* @return Reference to this builder for method chaining.
*/
AMMPositionBuilder&
setAMMID(std::decay_t<typename SF_UINT256::type::value_type> const& value)
{
object_[sfAMMID] = value;
return *this;
}
/**
* @brief Set sfTickLower (SoeRequired)
* @return Reference to this builder for method chaining.
*/
AMMPositionBuilder&
setTickLower(std::decay_t<typename SF_INT32::type::value_type> const& value)
{
object_[sfTickLower] = value;
return *this;
}
/**
* @brief Set sfTickUpper (SoeRequired)
* @return Reference to this builder for method chaining.
*/
AMMPositionBuilder&
setTickUpper(std::decay_t<typename SF_INT32::type::value_type> const& value)
{
object_[sfTickUpper] = value;
return *this;
}
/**
* @brief Set sfPositionLiquidity (SoeRequired)
* @return Reference to this builder for method chaining.
*/
AMMPositionBuilder&
setPositionLiquidity(std::decay_t<typename SF_UINT64::type::value_type> const& value)
{
object_[sfPositionLiquidity] = value;
return *this;
}
/**
* @brief Set sfFeeGrowthInsideLast0 (SoeRequired)
* @return Reference to this builder for method chaining.
*/
AMMPositionBuilder&
setFeeGrowthInsideLast0(std::decay_t<typename SF_NUMBER::type::value_type> const& value)
{
object_[sfFeeGrowthInsideLast0] = value;
return *this;
}
/**
* @brief Set sfFeeGrowthInsideLast1 (SoeRequired)
* @return Reference to this builder for method chaining.
*/
AMMPositionBuilder&
setFeeGrowthInsideLast1(std::decay_t<typename SF_NUMBER::type::value_type> const& value)
{
object_[sfFeeGrowthInsideLast1] = value;
return *this;
}
/**
* @brief Set sfTokensOwed0 (SoeDefault)
* @return Reference to this builder for method chaining.
*/
AMMPositionBuilder&
setTokensOwed0(std::decay_t<typename SF_AMOUNT::type::value_type> const& value)
{
object_[sfTokensOwed0] = value;
return *this;
}
/**
* @brief Set sfTokensOwed1 (SoeDefault)
* @return Reference to this builder for method chaining.
*/
AMMPositionBuilder&
setTokensOwed1(std::decay_t<typename SF_AMOUNT::type::value_type> const& value)
{
object_[sfTokensOwed1] = value;
return *this;
}
/**
* @brief Set sfOwnerNode (SoeRequired)
* @return Reference to this builder for method chaining.
*/
AMMPositionBuilder&
setOwnerNode(std::decay_t<typename SF_UINT64::type::value_type> const& value)
{
object_[sfOwnerNode] = value;
return *this;
}
/**
* @brief Build and return the completed AMMPosition wrapper.
* @param index The ledger entry index.
* @return The constructed ledger entry wrapper.
*/
AMMPosition
build(uint256 const& index)
{
return AMMPosition{std::make_shared<SLE>(std::move(object_), index)};
}
};
} // namespace xrpl::ledger_entries

View File

@@ -0,0 +1,265 @@
// 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/LedgerEntryBase.h>
#include <xrpl/protocol_autogen/LedgerEntryBuilderBase.h>
#include <xrpl/json/json_value.h>
#include <stdexcept>
#include <optional>
namespace xrpl::ledger_entries {
class AMMTickBuilder;
/**
* @brief Ledger Entry: AMMTick
*
* Type: ltAMM_TICK (0x007b)
* RPC Name: amm_tick
*
* Immutable wrapper around SLE providing type-safe field access.
* Use AMMTickBuilder to construct new ledger entries.
*/
class AMMTick : public LedgerEntryBase
{
public:
static constexpr LedgerEntryType entryType = ltAMM_TICK;
/**
* @brief Construct a AMMTick ledger entry wrapper from an existing SLE object.
* @throws std::runtime_error if the ledger entry type doesn't match.
*/
explicit AMMTick(SLE::const_pointer sle)
: LedgerEntryBase(std::move(sle))
{
// Verify ledger entry type
if (sle_->getType() != entryType)
{
throw std::runtime_error("Invalid ledger entry type for AMMTick");
}
}
// Ledger entry-specific field getters
/**
* @brief Get sfAMMID (SoeRequired)
* @return The field value.
*/
[[nodiscard]]
SF_UINT256::type::value_type
getAMMID() const
{
return this->sle_->at(sfAMMID);
}
/**
* @brief Get sfTickIndex (SoeRequired)
* @return The field value.
*/
[[nodiscard]]
SF_INT32::type::value_type
getTickIndex() const
{
return this->sle_->at(sfTickIndex);
}
/**
* @brief Get sfLiquidityNet (SoeRequired)
* @return The field value.
*/
[[nodiscard]]
SF_UINT64::type::value_type
getLiquidityNet() const
{
return this->sle_->at(sfLiquidityNet);
}
/**
* @brief Get sfLiquidityGross (SoeRequired)
* @return The field value.
*/
[[nodiscard]]
SF_UINT64::type::value_type
getLiquidityGross() const
{
return this->sle_->at(sfLiquidityGross);
}
/**
* @brief Get sfFeeGrowthOutside0 (SoeRequired)
* @return The field value.
*/
[[nodiscard]]
SF_NUMBER::type::value_type
getFeeGrowthOutside0() const
{
return this->sle_->at(sfFeeGrowthOutside0);
}
/**
* @brief Get sfFeeGrowthOutside1 (SoeRequired)
* @return The field value.
*/
[[nodiscard]]
SF_NUMBER::type::value_type
getFeeGrowthOutside1() const
{
return this->sle_->at(sfFeeGrowthOutside1);
}
/**
* @brief Get sfOwnerNode (SoeRequired)
* @return The field value.
*/
[[nodiscard]]
SF_UINT64::type::value_type
getOwnerNode() const
{
return this->sle_->at(sfOwnerNode);
}
};
/**
* @brief Builder for AMMTick ledger entries.
*
* Provides a fluent interface for constructing ledger entries with method chaining.
* Uses STObject internally for flexible ledger entry construction.
* Inherits common field setters from LedgerEntryBuilderBase.
*/
class AMMTickBuilder : public LedgerEntryBuilderBase<AMMTickBuilder>
{
public:
/**
* @brief Construct a new AMMTickBuilder with required fields.
* @param aMMID The sfAMMID field value.
* @param tickIndex The sfTickIndex field value.
* @param liquidityNet The sfLiquidityNet field value.
* @param liquidityGross The sfLiquidityGross field value.
* @param feeGrowthOutside0 The sfFeeGrowthOutside0 field value.
* @param feeGrowthOutside1 The sfFeeGrowthOutside1 field value.
* @param ownerNode The sfOwnerNode field value.
*/
AMMTickBuilder(std::decay_t<typename SF_UINT256::type::value_type> const& aMMID,std::decay_t<typename SF_INT32::type::value_type> const& tickIndex,std::decay_t<typename SF_UINT64::type::value_type> const& liquidityNet,std::decay_t<typename SF_UINT64::type::value_type> const& liquidityGross,std::decay_t<typename SF_NUMBER::type::value_type> const& feeGrowthOutside0,std::decay_t<typename SF_NUMBER::type::value_type> const& feeGrowthOutside1,std::decay_t<typename SF_UINT64::type::value_type> const& ownerNode)
: LedgerEntryBuilderBase<AMMTickBuilder>(ltAMM_TICK)
{
setAMMID(aMMID);
setTickIndex(tickIndex);
setLiquidityNet(liquidityNet);
setLiquidityGross(liquidityGross);
setFeeGrowthOutside0(feeGrowthOutside0);
setFeeGrowthOutside1(feeGrowthOutside1);
setOwnerNode(ownerNode);
}
/**
* @brief Construct a AMMTickBuilder from an existing SLE object.
* @param sle The existing ledger entry to copy from.
* @throws std::runtime_error if the ledger entry type doesn't match.
*/
AMMTickBuilder(SLE::const_pointer sle)
{
if (sle->at(sfLedgerEntryType) != ltAMM_TICK)
{
throw std::runtime_error("Invalid ledger entry type for AMMTick");
}
object_ = *sle;
}
/**
* @brief Ledger entry-specific field setters
*/
/**
* @brief Set sfAMMID (SoeRequired)
* @return Reference to this builder for method chaining.
*/
AMMTickBuilder&
setAMMID(std::decay_t<typename SF_UINT256::type::value_type> const& value)
{
object_[sfAMMID] = value;
return *this;
}
/**
* @brief Set sfTickIndex (SoeRequired)
* @return Reference to this builder for method chaining.
*/
AMMTickBuilder&
setTickIndex(std::decay_t<typename SF_INT32::type::value_type> const& value)
{
object_[sfTickIndex] = value;
return *this;
}
/**
* @brief Set sfLiquidityNet (SoeRequired)
* @return Reference to this builder for method chaining.
*/
AMMTickBuilder&
setLiquidityNet(std::decay_t<typename SF_UINT64::type::value_type> const& value)
{
object_[sfLiquidityNet] = value;
return *this;
}
/**
* @brief Set sfLiquidityGross (SoeRequired)
* @return Reference to this builder for method chaining.
*/
AMMTickBuilder&
setLiquidityGross(std::decay_t<typename SF_UINT64::type::value_type> const& value)
{
object_[sfLiquidityGross] = value;
return *this;
}
/**
* @brief Set sfFeeGrowthOutside0 (SoeRequired)
* @return Reference to this builder for method chaining.
*/
AMMTickBuilder&
setFeeGrowthOutside0(std::decay_t<typename SF_NUMBER::type::value_type> const& value)
{
object_[sfFeeGrowthOutside0] = value;
return *this;
}
/**
* @brief Set sfFeeGrowthOutside1 (SoeRequired)
* @return Reference to this builder for method chaining.
*/
AMMTickBuilder&
setFeeGrowthOutside1(std::decay_t<typename SF_NUMBER::type::value_type> const& value)
{
object_[sfFeeGrowthOutside1] = value;
return *this;
}
/**
* @brief Set sfOwnerNode (SoeRequired)
* @return Reference to this builder for method chaining.
*/
AMMTickBuilder&
setOwnerNode(std::decay_t<typename SF_UINT64::type::value_type> const& value)
{
object_[sfOwnerNode] = value;
return *this;
}
/**
* @brief Build and return the completed AMMTick wrapper.
* @param index The ledger entry index.
* @return The constructed ledger entry wrapper.
*/
AMMTick
build(uint256 const& index)
{
return AMMTick{std::make_shared<SLE>(std::move(object_), index)};
}
};
} // namespace xrpl::ledger_entries

View File

@@ -0,0 +1,193 @@
// 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/LedgerEntryBase.h>
#include <xrpl/protocol_autogen/LedgerEntryBuilderBase.h>
#include <xrpl/json/json_value.h>
#include <stdexcept>
#include <optional>
namespace xrpl::ledger_entries {
class AMMTickBitmapBuilder;
/**
* @brief Ledger Entry: AMMTickBitmap
*
* Type: ltAMM_TICK_BITMAP (0x007c)
* RPC Name: amm_tick_bitmap
*
* Immutable wrapper around SLE providing type-safe field access.
* Use AMMTickBitmapBuilder to construct new ledger entries.
*/
class AMMTickBitmap : public LedgerEntryBase
{
public:
static constexpr LedgerEntryType entryType = ltAMM_TICK_BITMAP;
/**
* @brief Construct a AMMTickBitmap ledger entry wrapper from an existing SLE object.
* @throws std::runtime_error if the ledger entry type doesn't match.
*/
explicit AMMTickBitmap(SLE::const_pointer sle)
: LedgerEntryBase(std::move(sle))
{
// Verify ledger entry type
if (sle_->getType() != entryType)
{
throw std::runtime_error("Invalid ledger entry type for AMMTickBitmap");
}
}
// Ledger entry-specific field getters
/**
* @brief Get sfAMMID (SoeRequired)
* @return The field value.
*/
[[nodiscard]]
SF_UINT256::type::value_type
getAMMID() const
{
return this->sle_->at(sfAMMID);
}
/**
* @brief Get sfBitmapWordIndex (SoeRequired)
* @return The field value.
*/
[[nodiscard]]
SF_UINT16::type::value_type
getBitmapWordIndex() const
{
return this->sle_->at(sfBitmapWordIndex);
}
/**
* @brief Get sfBitmapBits (SoeRequired)
* @return The field value.
*/
[[nodiscard]]
SF_UINT256::type::value_type
getBitmapBits() const
{
return this->sle_->at(sfBitmapBits);
}
/**
* @brief Get sfOwnerNode (SoeRequired)
* @return The field value.
*/
[[nodiscard]]
SF_UINT64::type::value_type
getOwnerNode() const
{
return this->sle_->at(sfOwnerNode);
}
};
/**
* @brief Builder for AMMTickBitmap ledger entries.
*
* Provides a fluent interface for constructing ledger entries with method chaining.
* Uses STObject internally for flexible ledger entry construction.
* Inherits common field setters from LedgerEntryBuilderBase.
*/
class AMMTickBitmapBuilder : public LedgerEntryBuilderBase<AMMTickBitmapBuilder>
{
public:
/**
* @brief Construct a new AMMTickBitmapBuilder with required fields.
* @param aMMID The sfAMMID field value.
* @param bitmapWordIndex The sfBitmapWordIndex field value.
* @param bitmapBits The sfBitmapBits field value.
* @param ownerNode The sfOwnerNode field value.
*/
AMMTickBitmapBuilder(std::decay_t<typename SF_UINT256::type::value_type> const& aMMID,std::decay_t<typename SF_UINT16::type::value_type> const& bitmapWordIndex,std::decay_t<typename SF_UINT256::type::value_type> const& bitmapBits,std::decay_t<typename SF_UINT64::type::value_type> const& ownerNode)
: LedgerEntryBuilderBase<AMMTickBitmapBuilder>(ltAMM_TICK_BITMAP)
{
setAMMID(aMMID);
setBitmapWordIndex(bitmapWordIndex);
setBitmapBits(bitmapBits);
setOwnerNode(ownerNode);
}
/**
* @brief Construct a AMMTickBitmapBuilder from an existing SLE object.
* @param sle The existing ledger entry to copy from.
* @throws std::runtime_error if the ledger entry type doesn't match.
*/
AMMTickBitmapBuilder(SLE::const_pointer sle)
{
if (sle->at(sfLedgerEntryType) != ltAMM_TICK_BITMAP)
{
throw std::runtime_error("Invalid ledger entry type for AMMTickBitmap");
}
object_ = *sle;
}
/**
* @brief Ledger entry-specific field setters
*/
/**
* @brief Set sfAMMID (SoeRequired)
* @return Reference to this builder for method chaining.
*/
AMMTickBitmapBuilder&
setAMMID(std::decay_t<typename SF_UINT256::type::value_type> const& value)
{
object_[sfAMMID] = value;
return *this;
}
/**
* @brief Set sfBitmapWordIndex (SoeRequired)
* @return Reference to this builder for method chaining.
*/
AMMTickBitmapBuilder&
setBitmapWordIndex(std::decay_t<typename SF_UINT16::type::value_type> const& value)
{
object_[sfBitmapWordIndex] = value;
return *this;
}
/**
* @brief Set sfBitmapBits (SoeRequired)
* @return Reference to this builder for method chaining.
*/
AMMTickBitmapBuilder&
setBitmapBits(std::decay_t<typename SF_UINT256::type::value_type> const& value)
{
object_[sfBitmapBits] = value;
return *this;
}
/**
* @brief Set sfOwnerNode (SoeRequired)
* @return Reference to this builder for method chaining.
*/
AMMTickBitmapBuilder&
setOwnerNode(std::decay_t<typename SF_UINT64::type::value_type> const& value)
{
object_[sfOwnerNode] = value;
return *this;
}
/**
* @brief Build and return the completed AMMTickBitmap wrapper.
* @param index The ledger entry index.
* @return The constructed ledger entry wrapper.
*/
AMMTickBitmap
build(uint256 const& index)
{
return AMMTickBitmap{std::make_shared<SLE>(std::move(object_), index)};
}
};
} // namespace xrpl::ledger_entries

View File

@@ -0,0 +1,573 @@
// 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/LedgerEntryBase.h>
#include <xrpl/protocol_autogen/LedgerEntryBuilderBase.h>
#include <xrpl/json/json_value.h>
#include <stdexcept>
#include <optional>
namespace xrpl::ledger_entries {
class BallotBuilder;
/**
* @brief Ledger Entry: Ballot
*
* Type: ltBALLOT (0x0091)
* RPC Name: ballot
*
* Immutable wrapper around SLE providing type-safe field access.
* Use BallotBuilder to construct new ledger entries.
*/
class Ballot : public LedgerEntryBase
{
public:
static constexpr LedgerEntryType entryType = ltBALLOT;
/**
* @brief Construct a Ballot ledger entry wrapper from an existing SLE object.
* @throws std::runtime_error if the ledger entry type doesn't match.
*/
explicit Ballot(SLE::const_pointer sle)
: LedgerEntryBase(std::move(sle))
{
// Verify ledger entry type
if (sle_->getType() != entryType)
{
throw std::runtime_error("Invalid ledger entry type for Ballot");
}
}
// Ledger entry-specific field getters
/**
* @brief Get sfOwner (SoeRequired)
* @return The field value.
*/
[[nodiscard]]
SF_ACCOUNT::type::value_type
getOwner() const
{
return this->sle_->at(sfOwner);
}
/**
* @brief Get sfSequence (SoeRequired)
* @return The field value.
*/
[[nodiscard]]
SF_UINT32::type::value_type
getSequence() const
{
return this->sle_->at(sfSequence);
}
/**
* @brief Get sfMPTokenIssuanceID (SoeOptional)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
protocol_autogen::Optional<SF_UINT192::type::value_type>
getMPTokenIssuanceID() const
{
if (hasMPTokenIssuanceID())
return this->sle_->at(sfMPTokenIssuanceID);
return std::nullopt;
}
/**
* @brief Check if sfMPTokenIssuanceID is present.
* @return True if the field is present, false otherwise.
*/
[[nodiscard]]
bool
hasMPTokenIssuanceID() const
{
return this->sle_->isFieldPresent(sfMPTokenIssuanceID);
}
/**
* @brief Get sfDomainID (SoeOptional)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
protocol_autogen::Optional<SF_UINT256::type::value_type>
getDomainID() const
{
if (hasDomainID())
return this->sle_->at(sfDomainID);
return std::nullopt;
}
/**
* @brief Check if sfDomainID is present.
* @return True if the field is present, false otherwise.
*/
[[nodiscard]]
bool
hasDomainID() const
{
return this->sle_->isFieldPresent(sfDomainID);
}
/**
* @brief Get sfDigest (SoeRequired)
* @return The field value.
*/
[[nodiscard]]
SF_UINT256::type::value_type
getDigest() const
{
return this->sle_->at(sfDigest);
}
/**
* @brief Get sfURI (SoeOptional)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
protocol_autogen::Optional<SF_VL::type::value_type>
getURI() const
{
if (hasURI())
return this->sle_->at(sfURI);
return std::nullopt;
}
/**
* @brief Check if sfURI is present.
* @return True if the field is present, false otherwise.
*/
[[nodiscard]]
bool
hasURI() const
{
return this->sle_->isFieldPresent(sfURI);
}
/**
* @brief Get sfOptionCount (SoeRequired)
* @return The field value.
*/
[[nodiscard]]
SF_UINT8::type::value_type
getOptionCount() const
{
return this->sle_->at(sfOptionCount);
}
/**
* @brief Get sfTallyPublicKey (SoeRequired)
* @return The field value.
*/
[[nodiscard]]
SF_VL::type::value_type
getTallyPublicKey() const
{
return this->sle_->at(sfTallyPublicKey);
}
/**
* @brief Get sfAuditorEncryptionKey (SoeOptional)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
protocol_autogen::Optional<SF_VL::type::value_type>
getAuditorEncryptionKey() const
{
if (hasAuditorEncryptionKey())
return this->sle_->at(sfAuditorEncryptionKey);
return std::nullopt;
}
/**
* @brief Check if sfAuditorEncryptionKey is present.
* @return True if the field is present, false otherwise.
*/
[[nodiscard]]
bool
hasAuditorEncryptionKey() const
{
return this->sle_->isFieldPresent(sfAuditorEncryptionKey);
}
/**
* @brief Get sfEncryptedTally (SoeRequired)
* @note This is an untyped field (unknown).
* @return The field value.
*/
[[nodiscard]]
STArray const&
getEncryptedTally() const
{
return this->sle_->getFieldArray(sfEncryptedTally);
}
/**
* @brief Get sfOpenTime (SoeRequired)
* @return The field value.
*/
[[nodiscard]]
SF_UINT32::type::value_type
getOpenTime() const
{
return this->sle_->at(sfOpenTime);
}
/**
* @brief Get sfCloseTime (SoeRequired)
* @return The field value.
*/
[[nodiscard]]
SF_UINT32::type::value_type
getCloseTime() const
{
return this->sle_->at(sfCloseTime);
}
/**
* @brief Get sfVoteCount (SoeDefault)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
protocol_autogen::Optional<SF_UINT32::type::value_type>
getVoteCount() const
{
if (hasVoteCount())
return this->sle_->at(sfVoteCount);
return std::nullopt;
}
/**
* @brief Check if sfVoteCount is present.
* @return True if the field is present, false otherwise.
*/
[[nodiscard]]
bool
hasVoteCount() const
{
return this->sle_->isFieldPresent(sfVoteCount);
}
/**
* @brief Get sfResults (SoeOptional)
* @note This is an untyped field (unknown).
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
std::optional<std::reference_wrapper<STArray const>>
getResults() const
{
if (this->sle_->isFieldPresent(sfResults))
return this->sle_->getFieldArray(sfResults);
return std::nullopt;
}
/**
* @brief Check if sfResults is present.
* @return True if the field is present, false otherwise.
*/
[[nodiscard]]
bool
hasResults() const
{
return this->sle_->isFieldPresent(sfResults);
}
/**
* @brief Get sfOwnerNode (SoeRequired)
* @return The field value.
*/
[[nodiscard]]
SF_UINT64::type::value_type
getOwnerNode() const
{
return this->sle_->at(sfOwnerNode);
}
/**
* @brief Get sfPreviousTxnID (SoeRequired)
* @return The field value.
*/
[[nodiscard]]
SF_UINT256::type::value_type
getPreviousTxnID() const
{
return this->sle_->at(sfPreviousTxnID);
}
/**
* @brief Get sfPreviousTxnLgrSeq (SoeRequired)
* @return The field value.
*/
[[nodiscard]]
SF_UINT32::type::value_type
getPreviousTxnLgrSeq() const
{
return this->sle_->at(sfPreviousTxnLgrSeq);
}
};
/**
* @brief Builder for Ballot ledger entries.
*
* Provides a fluent interface for constructing ledger entries with method chaining.
* Uses STObject internally for flexible ledger entry construction.
* Inherits common field setters from LedgerEntryBuilderBase.
*/
class BallotBuilder : public LedgerEntryBuilderBase<BallotBuilder>
{
public:
/**
* @brief Construct a new BallotBuilder with required fields.
* @param owner The sfOwner field value.
* @param sequence The sfSequence field value.
* @param digest The sfDigest field value.
* @param optionCount The sfOptionCount field value.
* @param tallyPublicKey The sfTallyPublicKey field value.
* @param encryptedTally The sfEncryptedTally field value.
* @param openTime The sfOpenTime field value.
* @param closeTime The sfCloseTime field value.
* @param ownerNode The sfOwnerNode field value.
* @param previousTxnID The sfPreviousTxnID field value.
* @param previousTxnLgrSeq The sfPreviousTxnLgrSeq field value.
*/
BallotBuilder(std::decay_t<typename SF_ACCOUNT::type::value_type> const& owner,std::decay_t<typename SF_UINT32::type::value_type> const& sequence,std::decay_t<typename SF_UINT256::type::value_type> const& digest,std::decay_t<typename SF_UINT8::type::value_type> const& optionCount,std::decay_t<typename SF_VL::type::value_type> const& tallyPublicKey,STArray const& encryptedTally,std::decay_t<typename SF_UINT32::type::value_type> const& openTime,std::decay_t<typename SF_UINT32::type::value_type> const& closeTime,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<BallotBuilder>(ltBALLOT)
{
setOwner(owner);
setSequence(sequence);
setDigest(digest);
setOptionCount(optionCount);
setTallyPublicKey(tallyPublicKey);
setEncryptedTally(encryptedTally);
setOpenTime(openTime);
setCloseTime(closeTime);
setOwnerNode(ownerNode);
setPreviousTxnID(previousTxnID);
setPreviousTxnLgrSeq(previousTxnLgrSeq);
}
/**
* @brief Construct a BallotBuilder from an existing SLE object.
* @param sle The existing ledger entry to copy from.
* @throws std::runtime_error if the ledger entry type doesn't match.
*/
BallotBuilder(SLE::const_pointer sle)
{
if (sle->at(sfLedgerEntryType) != ltBALLOT)
{
throw std::runtime_error("Invalid ledger entry type for Ballot");
}
object_ = *sle;
}
/**
* @brief Ledger entry-specific field setters
*/
/**
* @brief Set sfOwner (SoeRequired)
* @return Reference to this builder for method chaining.
*/
BallotBuilder&
setOwner(std::decay_t<typename SF_ACCOUNT::type::value_type> const& value)
{
object_[sfOwner] = value;
return *this;
}
/**
* @brief Set sfSequence (SoeRequired)
* @return Reference to this builder for method chaining.
*/
BallotBuilder&
setSequence(std::decay_t<typename SF_UINT32::type::value_type> const& value)
{
object_[sfSequence] = value;
return *this;
}
/**
* @brief Set sfMPTokenIssuanceID (SoeOptional)
* @return Reference to this builder for method chaining.
*/
BallotBuilder&
setMPTokenIssuanceID(std::decay_t<typename SF_UINT192::type::value_type> const& value)
{
object_[sfMPTokenIssuanceID] = value;
return *this;
}
/**
* @brief Set sfDomainID (SoeOptional)
* @return Reference to this builder for method chaining.
*/
BallotBuilder&
setDomainID(std::decay_t<typename SF_UINT256::type::value_type> const& value)
{
object_[sfDomainID] = value;
return *this;
}
/**
* @brief Set sfDigest (SoeRequired)
* @return Reference to this builder for method chaining.
*/
BallotBuilder&
setDigest(std::decay_t<typename SF_UINT256::type::value_type> const& value)
{
object_[sfDigest] = value;
return *this;
}
/**
* @brief Set sfURI (SoeOptional)
* @return Reference to this builder for method chaining.
*/
BallotBuilder&
setURI(std::decay_t<typename SF_VL::type::value_type> const& value)
{
object_[sfURI] = value;
return *this;
}
/**
* @brief Set sfOptionCount (SoeRequired)
* @return Reference to this builder for method chaining.
*/
BallotBuilder&
setOptionCount(std::decay_t<typename SF_UINT8::type::value_type> const& value)
{
object_[sfOptionCount] = value;
return *this;
}
/**
* @brief Set sfTallyPublicKey (SoeRequired)
* @return Reference to this builder for method chaining.
*/
BallotBuilder&
setTallyPublicKey(std::decay_t<typename SF_VL::type::value_type> const& value)
{
object_[sfTallyPublicKey] = value;
return *this;
}
/**
* @brief Set sfAuditorEncryptionKey (SoeOptional)
* @return Reference to this builder for method chaining.
*/
BallotBuilder&
setAuditorEncryptionKey(std::decay_t<typename SF_VL::type::value_type> const& value)
{
object_[sfAuditorEncryptionKey] = value;
return *this;
}
/**
* @brief Set sfEncryptedTally (SoeRequired)
* @return Reference to this builder for method chaining.
*/
BallotBuilder&
setEncryptedTally(STArray const& value)
{
object_.setFieldArray(sfEncryptedTally, value);
return *this;
}
/**
* @brief Set sfOpenTime (SoeRequired)
* @return Reference to this builder for method chaining.
*/
BallotBuilder&
setOpenTime(std::decay_t<typename SF_UINT32::type::value_type> const& value)
{
object_[sfOpenTime] = value;
return *this;
}
/**
* @brief Set sfCloseTime (SoeRequired)
* @return Reference to this builder for method chaining.
*/
BallotBuilder&
setCloseTime(std::decay_t<typename SF_UINT32::type::value_type> const& value)
{
object_[sfCloseTime] = value;
return *this;
}
/**
* @brief Set sfVoteCount (SoeDefault)
* @return Reference to this builder for method chaining.
*/
BallotBuilder&
setVoteCount(std::decay_t<typename SF_UINT32::type::value_type> const& value)
{
object_[sfVoteCount] = value;
return *this;
}
/**
* @brief Set sfResults (SoeOptional)
* @return Reference to this builder for method chaining.
*/
BallotBuilder&
setResults(STArray const& value)
{
object_.setFieldArray(sfResults, value);
return *this;
}
/**
* @brief Set sfOwnerNode (SoeRequired)
* @return Reference to this builder for method chaining.
*/
BallotBuilder&
setOwnerNode(std::decay_t<typename SF_UINT64::type::value_type> const& value)
{
object_[sfOwnerNode] = value;
return *this;
}
/**
* @brief Set sfPreviousTxnID (SoeRequired)
* @return Reference to this builder for method chaining.
*/
BallotBuilder&
setPreviousTxnID(std::decay_t<typename SF_UINT256::type::value_type> const& value)
{
object_[sfPreviousTxnID] = value;
return *this;
}
/**
* @brief Set sfPreviousTxnLgrSeq (SoeRequired)
* @return Reference to this builder for method chaining.
*/
BallotBuilder&
setPreviousTxnLgrSeq(std::decay_t<typename SF_UINT32::type::value_type> const& value)
{
object_[sfPreviousTxnLgrSeq] = value;
return *this;
}
/**
* @brief Build and return the completed Ballot wrapper.
* @param index The ledger entry index.
* @return The constructed ledger entry wrapper.
*/
Ballot
build(uint256 const& index)
{
return Ballot{std::make_shared<SLE>(std::move(object_), index)};
}
};
} // namespace xrpl::ledger_entries

View File

@@ -0,0 +1,373 @@
// 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/LedgerEntryBase.h>
#include <xrpl/protocol_autogen/LedgerEntryBuilderBase.h>
#include <xrpl/json/json_value.h>
#include <stdexcept>
#include <optional>
namespace xrpl::ledger_entries {
class BallotVoteBuilder;
/**
* @brief Ledger Entry: BallotVote
*
* Type: ltBALLOT_VOTE (0x0092)
* RPC Name: ballot_vote
*
* Immutable wrapper around SLE providing type-safe field access.
* Use BallotVoteBuilder to construct new ledger entries.
*/
class BallotVote : public LedgerEntryBase
{
public:
static constexpr LedgerEntryType entryType = ltBALLOT_VOTE;
/**
* @brief Construct a BallotVote ledger entry wrapper from an existing SLE object.
* @throws std::runtime_error if the ledger entry type doesn't match.
*/
explicit BallotVote(SLE::const_pointer sle)
: LedgerEntryBase(std::move(sle))
{
// Verify ledger entry type
if (sle_->getType() != entryType)
{
throw std::runtime_error("Invalid ledger entry type for BallotVote");
}
}
// Ledger entry-specific field getters
/**
* @brief Get sfAccount (SoeRequired)
* @return The field value.
*/
[[nodiscard]]
SF_ACCOUNT::type::value_type
getAccount() const
{
return this->sle_->at(sfAccount);
}
/**
* @brief Get sfBallotID (SoeRequired)
* @return The field value.
*/
[[nodiscard]]
SF_UINT256::type::value_type
getBallotID() const
{
return this->sle_->at(sfBallotID);
}
/**
* @brief Get sfBallotWeight (SoeRequired)
* @return The field value.
*/
[[nodiscard]]
SF_UINT64::type::value_type
getBallotWeight() const
{
return this->sle_->at(sfBallotWeight);
}
/**
* @brief Get sfEncryptedVotes (SoeRequired)
* @note This is an untyped field (unknown).
* @return The field value.
*/
[[nodiscard]]
STArray const&
getEncryptedVotes() const
{
return this->sle_->getFieldArray(sfEncryptedVotes);
}
/**
* @brief Get sfAuditorEncryptedVotes (SoeOptional)
* @note This is an untyped field (unknown).
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
std::optional<std::reference_wrapper<STArray const>>
getAuditorEncryptedVotes() const
{
if (this->sle_->isFieldPresent(sfAuditorEncryptedVotes))
return this->sle_->getFieldArray(sfAuditorEncryptedVotes);
return std::nullopt;
}
/**
* @brief Check if sfAuditorEncryptedVotes is present.
* @return True if the field is present, false otherwise.
*/
[[nodiscard]]
bool
hasAuditorEncryptedVotes() const
{
return this->sle_->isFieldPresent(sfAuditorEncryptedVotes);
}
/**
* @brief Get sfVoterPublicKey (SoeOptional)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
protocol_autogen::Optional<SF_VL::type::value_type>
getVoterPublicKey() const
{
if (hasVoterPublicKey())
return this->sle_->at(sfVoterPublicKey);
return std::nullopt;
}
/**
* @brief Check if sfVoterPublicKey is present.
* @return True if the field is present, false otherwise.
*/
[[nodiscard]]
bool
hasVoterPublicKey() const
{
return this->sle_->isFieldPresent(sfVoterPublicKey);
}
/**
* @brief Get sfVoterEncryptedVotes (SoeOptional)
* @note This is an untyped field (unknown).
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
std::optional<std::reference_wrapper<STArray const>>
getVoterEncryptedVotes() const
{
if (this->sle_->isFieldPresent(sfVoterEncryptedVotes))
return this->sle_->getFieldArray(sfVoterEncryptedVotes);
return std::nullopt;
}
/**
* @brief Check if sfVoterEncryptedVotes is present.
* @return True if the field is present, false otherwise.
*/
[[nodiscard]]
bool
hasVoterEncryptedVotes() const
{
return this->sle_->isFieldPresent(sfVoterEncryptedVotes);
}
/**
* @brief Get sfOwnerNode (SoeRequired)
* @return The field value.
*/
[[nodiscard]]
SF_UINT64::type::value_type
getOwnerNode() const
{
return this->sle_->at(sfOwnerNode);
}
/**
* @brief Get sfPreviousTxnID (SoeRequired)
* @return The field value.
*/
[[nodiscard]]
SF_UINT256::type::value_type
getPreviousTxnID() const
{
return this->sle_->at(sfPreviousTxnID);
}
/**
* @brief Get sfPreviousTxnLgrSeq (SoeRequired)
* @return The field value.
*/
[[nodiscard]]
SF_UINT32::type::value_type
getPreviousTxnLgrSeq() const
{
return this->sle_->at(sfPreviousTxnLgrSeq);
}
};
/**
* @brief Builder for BallotVote ledger entries.
*
* Provides a fluent interface for constructing ledger entries with method chaining.
* Uses STObject internally for flexible ledger entry construction.
* Inherits common field setters from LedgerEntryBuilderBase.
*/
class BallotVoteBuilder : public LedgerEntryBuilderBase<BallotVoteBuilder>
{
public:
/**
* @brief Construct a new BallotVoteBuilder with required fields.
* @param account The sfAccount field value.
* @param ballotID The sfBallotID field value.
* @param ballotWeight The sfBallotWeight field value.
* @param encryptedVotes The sfEncryptedVotes field value.
* @param ownerNode The sfOwnerNode field value.
* @param previousTxnID The sfPreviousTxnID field value.
* @param previousTxnLgrSeq The sfPreviousTxnLgrSeq field value.
*/
BallotVoteBuilder(std::decay_t<typename SF_ACCOUNT::type::value_type> const& account,std::decay_t<typename SF_UINT256::type::value_type> const& ballotID,std::decay_t<typename SF_UINT64::type::value_type> const& ballotWeight,STArray const& encryptedVotes,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<BallotVoteBuilder>(ltBALLOT_VOTE)
{
setAccount(account);
setBallotID(ballotID);
setBallotWeight(ballotWeight);
setEncryptedVotes(encryptedVotes);
setOwnerNode(ownerNode);
setPreviousTxnID(previousTxnID);
setPreviousTxnLgrSeq(previousTxnLgrSeq);
}
/**
* @brief Construct a BallotVoteBuilder from an existing SLE object.
* @param sle The existing ledger entry to copy from.
* @throws std::runtime_error if the ledger entry type doesn't match.
*/
BallotVoteBuilder(SLE::const_pointer sle)
{
if (sle->at(sfLedgerEntryType) != ltBALLOT_VOTE)
{
throw std::runtime_error("Invalid ledger entry type for BallotVote");
}
object_ = *sle;
}
/**
* @brief Ledger entry-specific field setters
*/
/**
* @brief Set sfAccount (SoeRequired)
* @return Reference to this builder for method chaining.
*/
BallotVoteBuilder&
setAccount(std::decay_t<typename SF_ACCOUNT::type::value_type> const& value)
{
object_[sfAccount] = value;
return *this;
}
/**
* @brief Set sfBallotID (SoeRequired)
* @return Reference to this builder for method chaining.
*/
BallotVoteBuilder&
setBallotID(std::decay_t<typename SF_UINT256::type::value_type> const& value)
{
object_[sfBallotID] = value;
return *this;
}
/**
* @brief Set sfBallotWeight (SoeRequired)
* @return Reference to this builder for method chaining.
*/
BallotVoteBuilder&
setBallotWeight(std::decay_t<typename SF_UINT64::type::value_type> const& value)
{
object_[sfBallotWeight] = value;
return *this;
}
/**
* @brief Set sfEncryptedVotes (SoeRequired)
* @return Reference to this builder for method chaining.
*/
BallotVoteBuilder&
setEncryptedVotes(STArray const& value)
{
object_.setFieldArray(sfEncryptedVotes, value);
return *this;
}
/**
* @brief Set sfAuditorEncryptedVotes (SoeOptional)
* @return Reference to this builder for method chaining.
*/
BallotVoteBuilder&
setAuditorEncryptedVotes(STArray const& value)
{
object_.setFieldArray(sfAuditorEncryptedVotes, value);
return *this;
}
/**
* @brief Set sfVoterPublicKey (SoeOptional)
* @return Reference to this builder for method chaining.
*/
BallotVoteBuilder&
setVoterPublicKey(std::decay_t<typename SF_VL::type::value_type> const& value)
{
object_[sfVoterPublicKey] = value;
return *this;
}
/**
* @brief Set sfVoterEncryptedVotes (SoeOptional)
* @return Reference to this builder for method chaining.
*/
BallotVoteBuilder&
setVoterEncryptedVotes(STArray const& value)
{
object_.setFieldArray(sfVoterEncryptedVotes, value);
return *this;
}
/**
* @brief Set sfOwnerNode (SoeRequired)
* @return Reference to this builder for method chaining.
*/
BallotVoteBuilder&
setOwnerNode(std::decay_t<typename SF_UINT64::type::value_type> const& value)
{
object_[sfOwnerNode] = value;
return *this;
}
/**
* @brief Set sfPreviousTxnID (SoeRequired)
* @return Reference to this builder for method chaining.
*/
BallotVoteBuilder&
setPreviousTxnID(std::decay_t<typename SF_UINT256::type::value_type> const& value)
{
object_[sfPreviousTxnID] = value;
return *this;
}
/**
* @brief Set sfPreviousTxnLgrSeq (SoeRequired)
* @return Reference to this builder for method chaining.
*/
BallotVoteBuilder&
setPreviousTxnLgrSeq(std::decay_t<typename SF_UINT32::type::value_type> const& value)
{
object_[sfPreviousTxnLgrSeq] = value;
return *this;
}
/**
* @brief Build and return the completed BallotVote wrapper.
* @param index The ledger entry index.
* @return The constructed ledger entry wrapper.
*/
BallotVote
build(uint256 const& index)
{
return BallotVote{std::make_shared<SLE>(std::move(object_), index)};
}
};
} // namespace xrpl::ledger_entries

View File

@@ -0,0 +1,650 @@
// 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/LedgerEntryBase.h>
#include <xrpl/protocol_autogen/LedgerEntryBuilderBase.h>
#include <xrpl/json/json_value.h>
#include <stdexcept>
#include <optional>
namespace xrpl::ledger_entries {
class CouponScheduleBuilder;
/**
* @brief Ledger Entry: CouponSchedule
*
* Type: ltCOUPON_SCHEDULE (0x0098)
* RPC Name: coupon_schedule
*
* Immutable wrapper around SLE providing type-safe field access.
* Use CouponScheduleBuilder to construct new ledger entries.
*/
class CouponSchedule : public LedgerEntryBase
{
public:
static constexpr LedgerEntryType entryType = ltCOUPON_SCHEDULE;
/**
* @brief Construct a CouponSchedule ledger entry wrapper from an existing SLE object.
* @throws std::runtime_error if the ledger entry type doesn't match.
*/
explicit CouponSchedule(SLE::const_pointer sle)
: LedgerEntryBase(std::move(sle))
{
// Verify ledger entry type
if (sle_->getType() != entryType)
{
throw std::runtime_error("Invalid ledger entry type for CouponSchedule");
}
}
// Ledger entry-specific field getters
/**
* @brief Get sfPreviousTxnID (SoeRequired)
* @return The field value.
*/
[[nodiscard]]
SF_UINT256::type::value_type
getPreviousTxnID() const
{
return this->sle_->at(sfPreviousTxnID);
}
/**
* @brief Get sfPreviousTxnLgrSeq (SoeRequired)
* @return The field value.
*/
[[nodiscard]]
SF_UINT32::type::value_type
getPreviousTxnLgrSeq() const
{
return this->sle_->at(sfPreviousTxnLgrSeq);
}
/**
* @brief Get sfOwnerNode (SoeRequired)
* @return The field value.
*/
[[nodiscard]]
SF_UINT64::type::value_type
getOwnerNode() const
{
return this->sle_->at(sfOwnerNode);
}
/**
* @brief Get sfOwner (SoeRequired)
* @return The field value.
*/
[[nodiscard]]
SF_ACCOUNT::type::value_type
getOwner() const
{
return this->sle_->at(sfOwner);
}
/**
* @brief Get sfAccount (SoeRequired)
* @return The field value.
*/
[[nodiscard]]
SF_ACCOUNT::type::value_type
getAccount() const
{
return this->sle_->at(sfAccount);
}
/**
* @brief Get sfMPTokenIssuanceID (SoeRequired)
* @return The field value.
*/
[[nodiscard]]
SF_UINT192::type::value_type
getMPTokenIssuanceID() const
{
return this->sle_->at(sfMPTokenIssuanceID);
}
/**
* @brief Get sfCouponAsset (SoeRequired)
* @return The field value.
*/
[[nodiscard]]
SF_ISSUE::type::value_type
getCouponAsset() const
{
return this->sle_->at(sfCouponAsset);
}
/**
* @brief Get sfAccruedPerUnit (SoeDefault)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
protocol_autogen::Optional<SF_AMOUNT::type::value_type>
getAccruedPerUnit() const
{
if (hasAccruedPerUnit())
return this->sle_->at(sfAccruedPerUnit);
return std::nullopt;
}
/**
* @brief Check if sfAccruedPerUnit is present.
* @return True if the field is present, false otherwise.
*/
[[nodiscard]]
bool
hasAccruedPerUnit() const
{
return this->sle_->isFieldPresent(sfAccruedPerUnit);
}
/**
* @brief Get sfPoolAmount (SoeDefault)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
protocol_autogen::Optional<SF_AMOUNT::type::value_type>
getPoolAmount() const
{
if (hasPoolAmount())
return this->sle_->at(sfPoolAmount);
return std::nullopt;
}
/**
* @brief Check if sfPoolAmount is present.
* @return True if the field is present, false otherwise.
*/
[[nodiscard]]
bool
hasPoolAmount() const
{
return this->sle_->isFieldPresent(sfPoolAmount);
}
/**
* @brief Get sfClaimantCount (SoeDefault)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
protocol_autogen::Optional<SF_UINT32::type::value_type>
getClaimantCount() const
{
if (hasClaimantCount())
return this->sle_->at(sfClaimantCount);
return std::nullopt;
}
/**
* @brief Check if sfClaimantCount is present.
* @return True if the field is present, false otherwise.
*/
[[nodiscard]]
bool
hasClaimantCount() const
{
return this->sle_->isFieldPresent(sfClaimantCount);
}
/**
* @brief Get sfCouponCount (SoeDefault)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
protocol_autogen::Optional<SF_UINT32::type::value_type>
getCouponCount() const
{
if (hasCouponCount())
return this->sle_->at(sfCouponCount);
return std::nullopt;
}
/**
* @brief Check if sfCouponCount is present.
* @return True if the field is present, false otherwise.
*/
[[nodiscard]]
bool
hasCouponCount() const
{
return this->sle_->isFieldPresent(sfCouponCount);
}
/**
* @brief Get sfLastCouponTime (SoeOptional)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
protocol_autogen::Optional<SF_UINT32::type::value_type>
getLastCouponTime() const
{
if (hasLastCouponTime())
return this->sle_->at(sfLastCouponTime);
return std::nullopt;
}
/**
* @brief Check if sfLastCouponTime is present.
* @return True if the field is present, false otherwise.
*/
[[nodiscard]]
bool
hasLastCouponTime() const
{
return this->sle_->isFieldPresent(sfLastCouponTime);
}
/**
* @brief Get sfCouponAmount (SoeOptional)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
protocol_autogen::Optional<SF_AMOUNT::type::value_type>
getCouponAmount() const
{
if (hasCouponAmount())
return this->sle_->at(sfCouponAmount);
return std::nullopt;
}
/**
* @brief Check if sfCouponAmount is present.
* @return True if the field is present, false otherwise.
*/
[[nodiscard]]
bool
hasCouponAmount() const
{
return this->sle_->isFieldPresent(sfCouponAmount);
}
/**
* @brief Get sfCouponInterval (SoeOptional)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
protocol_autogen::Optional<SF_UINT32::type::value_type>
getCouponInterval() const
{
if (hasCouponInterval())
return this->sle_->at(sfCouponInterval);
return std::nullopt;
}
/**
* @brief Check if sfCouponInterval is present.
* @return True if the field is present, false otherwise.
*/
[[nodiscard]]
bool
hasCouponInterval() const
{
return this->sle_->isFieldPresent(sfCouponInterval);
}
/**
* @brief Get sfFirstCouponTime (SoeOptional)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
protocol_autogen::Optional<SF_UINT32::type::value_type>
getFirstCouponTime() const
{
if (hasFirstCouponTime())
return this->sle_->at(sfFirstCouponTime);
return std::nullopt;
}
/**
* @brief Check if sfFirstCouponTime is present.
* @return True if the field is present, false otherwise.
*/
[[nodiscard]]
bool
hasFirstCouponTime() const
{
return this->sle_->isFieldPresent(sfFirstCouponTime);
}
/**
* @brief Get sfExpiration (SoeOptional)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
protocol_autogen::Optional<SF_UINT32::type::value_type>
getExpiration() const
{
if (hasExpiration())
return this->sle_->at(sfExpiration);
return std::nullopt;
}
/**
* @brief Check if sfExpiration is present.
* @return True if the field is present, false otherwise.
*/
[[nodiscard]]
bool
hasExpiration() const
{
return this->sle_->isFieldPresent(sfExpiration);
}
/**
* @brief Get sfCallNoticePeriod (SoeOptional)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
protocol_autogen::Optional<SF_UINT32::type::value_type>
getCallNoticePeriod() const
{
if (hasCallNoticePeriod())
return this->sle_->at(sfCallNoticePeriod);
return std::nullopt;
}
/**
* @brief Check if sfCallNoticePeriod is present.
* @return True if the field is present, false otherwise.
*/
[[nodiscard]]
bool
hasCallNoticePeriod() const
{
return this->sle_->isFieldPresent(sfCallNoticePeriod);
}
/**
* @brief Get sfEarliestCallTime (SoeOptional)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
protocol_autogen::Optional<SF_UINT32::type::value_type>
getEarliestCallTime() const
{
if (hasEarliestCallTime())
return this->sle_->at(sfEarliestCallTime);
return std::nullopt;
}
/**
* @brief Check if sfEarliestCallTime is present.
* @return True if the field is present, false otherwise.
*/
[[nodiscard]]
bool
hasEarliestCallTime() const
{
return this->sle_->isFieldPresent(sfEarliestCallTime);
}
};
/**
* @brief Builder for CouponSchedule ledger entries.
*
* Provides a fluent interface for constructing ledger entries with method chaining.
* Uses STObject internally for flexible ledger entry construction.
* Inherits common field setters from LedgerEntryBuilderBase.
*/
class CouponScheduleBuilder : public LedgerEntryBuilderBase<CouponScheduleBuilder>
{
public:
/**
* @brief Construct a new CouponScheduleBuilder with required fields.
* @param previousTxnID The sfPreviousTxnID field value.
* @param previousTxnLgrSeq The sfPreviousTxnLgrSeq field value.
* @param ownerNode The sfOwnerNode field value.
* @param owner The sfOwner field value.
* @param account The sfAccount field value.
* @param mPTokenIssuanceID The sfMPTokenIssuanceID field value.
* @param couponAsset The sfCouponAsset field value.
*/
CouponScheduleBuilder(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_ACCOUNT::type::value_type> const& owner,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_ISSUE::type::value_type> const& couponAsset)
: LedgerEntryBuilderBase<CouponScheduleBuilder>(ltCOUPON_SCHEDULE)
{
setPreviousTxnID(previousTxnID);
setPreviousTxnLgrSeq(previousTxnLgrSeq);
setOwnerNode(ownerNode);
setOwner(owner);
setAccount(account);
setMPTokenIssuanceID(mPTokenIssuanceID);
setCouponAsset(couponAsset);
}
/**
* @brief Construct a CouponScheduleBuilder from an existing SLE object.
* @param sle The existing ledger entry to copy from.
* @throws std::runtime_error if the ledger entry type doesn't match.
*/
CouponScheduleBuilder(SLE::const_pointer sle)
{
if (sle->at(sfLedgerEntryType) != ltCOUPON_SCHEDULE)
{
throw std::runtime_error("Invalid ledger entry type for CouponSchedule");
}
object_ = *sle;
}
/**
* @brief Ledger entry-specific field setters
*/
/**
* @brief Set sfPreviousTxnID (SoeRequired)
* @return Reference to this builder for method chaining.
*/
CouponScheduleBuilder&
setPreviousTxnID(std::decay_t<typename SF_UINT256::type::value_type> const& value)
{
object_[sfPreviousTxnID] = value;
return *this;
}
/**
* @brief Set sfPreviousTxnLgrSeq (SoeRequired)
* @return Reference to this builder for method chaining.
*/
CouponScheduleBuilder&
setPreviousTxnLgrSeq(std::decay_t<typename SF_UINT32::type::value_type> const& value)
{
object_[sfPreviousTxnLgrSeq] = value;
return *this;
}
/**
* @brief Set sfOwnerNode (SoeRequired)
* @return Reference to this builder for method chaining.
*/
CouponScheduleBuilder&
setOwnerNode(std::decay_t<typename SF_UINT64::type::value_type> const& value)
{
object_[sfOwnerNode] = value;
return *this;
}
/**
* @brief Set sfOwner (SoeRequired)
* @return Reference to this builder for method chaining.
*/
CouponScheduleBuilder&
setOwner(std::decay_t<typename SF_ACCOUNT::type::value_type> const& value)
{
object_[sfOwner] = value;
return *this;
}
/**
* @brief Set sfAccount (SoeRequired)
* @return Reference to this builder for method chaining.
*/
CouponScheduleBuilder&
setAccount(std::decay_t<typename SF_ACCOUNT::type::value_type> const& value)
{
object_[sfAccount] = value;
return *this;
}
/**
* @brief Set sfMPTokenIssuanceID (SoeRequired)
* @return Reference to this builder for method chaining.
*/
CouponScheduleBuilder&
setMPTokenIssuanceID(std::decay_t<typename SF_UINT192::type::value_type> const& value)
{
object_[sfMPTokenIssuanceID] = value;
return *this;
}
/**
* @brief Set sfCouponAsset (SoeRequired)
* @return Reference to this builder for method chaining.
*/
CouponScheduleBuilder&
setCouponAsset(std::decay_t<typename SF_ISSUE::type::value_type> const& value)
{
object_[sfCouponAsset] = STIssue(sfCouponAsset, value);
return *this;
}
/**
* @brief Set sfAccruedPerUnit (SoeDefault)
* @return Reference to this builder for method chaining.
*/
CouponScheduleBuilder&
setAccruedPerUnit(std::decay_t<typename SF_AMOUNT::type::value_type> const& value)
{
object_[sfAccruedPerUnit] = value;
return *this;
}
/**
* @brief Set sfPoolAmount (SoeDefault)
* @return Reference to this builder for method chaining.
*/
CouponScheduleBuilder&
setPoolAmount(std::decay_t<typename SF_AMOUNT::type::value_type> const& value)
{
object_[sfPoolAmount] = value;
return *this;
}
/**
* @brief Set sfClaimantCount (SoeDefault)
* @return Reference to this builder for method chaining.
*/
CouponScheduleBuilder&
setClaimantCount(std::decay_t<typename SF_UINT32::type::value_type> const& value)
{
object_[sfClaimantCount] = value;
return *this;
}
/**
* @brief Set sfCouponCount (SoeDefault)
* @return Reference to this builder for method chaining.
*/
CouponScheduleBuilder&
setCouponCount(std::decay_t<typename SF_UINT32::type::value_type> const& value)
{
object_[sfCouponCount] = value;
return *this;
}
/**
* @brief Set sfLastCouponTime (SoeOptional)
* @return Reference to this builder for method chaining.
*/
CouponScheduleBuilder&
setLastCouponTime(std::decay_t<typename SF_UINT32::type::value_type> const& value)
{
object_[sfLastCouponTime] = value;
return *this;
}
/**
* @brief Set sfCouponAmount (SoeOptional)
* @return Reference to this builder for method chaining.
*/
CouponScheduleBuilder&
setCouponAmount(std::decay_t<typename SF_AMOUNT::type::value_type> const& value)
{
object_[sfCouponAmount] = value;
return *this;
}
/**
* @brief Set sfCouponInterval (SoeOptional)
* @return Reference to this builder for method chaining.
*/
CouponScheduleBuilder&
setCouponInterval(std::decay_t<typename SF_UINT32::type::value_type> const& value)
{
object_[sfCouponInterval] = value;
return *this;
}
/**
* @brief Set sfFirstCouponTime (SoeOptional)
* @return Reference to this builder for method chaining.
*/
CouponScheduleBuilder&
setFirstCouponTime(std::decay_t<typename SF_UINT32::type::value_type> const& value)
{
object_[sfFirstCouponTime] = value;
return *this;
}
/**
* @brief Set sfExpiration (SoeOptional)
* @return Reference to this builder for method chaining.
*/
CouponScheduleBuilder&
setExpiration(std::decay_t<typename SF_UINT32::type::value_type> const& value)
{
object_[sfExpiration] = value;
return *this;
}
/**
* @brief Set sfCallNoticePeriod (SoeOptional)
* @return Reference to this builder for method chaining.
*/
CouponScheduleBuilder&
setCallNoticePeriod(std::decay_t<typename SF_UINT32::type::value_type> const& value)
{
object_[sfCallNoticePeriod] = value;
return *this;
}
/**
* @brief Set sfEarliestCallTime (SoeOptional)
* @return Reference to this builder for method chaining.
*/
CouponScheduleBuilder&
setEarliestCallTime(std::decay_t<typename SF_UINT32::type::value_type> const& value)
{
object_[sfEarliestCallTime] = value;
return *this;
}
/**
* @brief Build and return the completed CouponSchedule wrapper.
* @param index The ledger entry index.
* @return The constructed ledger entry wrapper.
*/
CouponSchedule
build(uint256 const& index)
{
return CouponSchedule{std::make_shared<SLE>(std::move(object_), index)};
}
};
} // namespace xrpl::ledger_entries

View File

@@ -174,6 +174,54 @@ public:
return this->sle_->isFieldPresent(sfFinishAfter);
}
/**
* @brief Get sfBytecode (SoeOptional)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
protocol_autogen::Optional<SF_VL::type::value_type>
getBytecode() const
{
if (hasBytecode())
return this->sle_->at(sfBytecode);
return std::nullopt;
}
/**
* @brief Check if sfBytecode is present.
* @return True if the field is present, false otherwise.
*/
[[nodiscard]]
bool
hasBytecode() const
{
return this->sle_->isFieldPresent(sfBytecode);
}
/**
* @brief Get sfData (SoeOptional)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
protocol_autogen::Optional<SF_VL::type::value_type>
getData() const
{
if (hasData())
return this->sle_->at(sfData);
return std::nullopt;
}
/**
* @brief Check if sfData is present.
* @return True if the field is present, false otherwise.
*/
[[nodiscard]]
bool
hasData() const
{
return this->sle_->isFieldPresent(sfData);
}
/**
* @brief Get sfSourceTag (SoeOptional)
* @return The field value, or std::nullopt if not present.
@@ -453,6 +501,28 @@ public:
return *this;
}
/**
* @brief Set sfBytecode (SoeOptional)
* @return Reference to this builder for method chaining.
*/
EscrowBuilder&
setBytecode(std::decay_t<typename SF_VL::type::value_type> const& value)
{
object_[sfBytecode] = value;
return *this;
}
/**
* @brief Set sfData (SoeOptional)
* @return Reference to this builder for method chaining.
*/
EscrowBuilder&
setData(std::decay_t<typename SF_VL::type::value_type> const& value)
{
object_[sfData] = value;
return *this;
}
/**
* @brief Set sfSourceTag (SoeOptional)
* @return Reference to this builder for method chaining.

View File

@@ -213,6 +213,78 @@ public:
return this->sle_->isFieldPresent(sfReserveIncrementDrops);
}
/**
* @brief Get sfGasLimit (SoeOptional)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
protocol_autogen::Optional<SF_UINT32::type::value_type>
getGasLimit() const
{
if (hasGasLimit())
return this->sle_->at(sfGasLimit);
return std::nullopt;
}
/**
* @brief Check if sfGasLimit is present.
* @return True if the field is present, false otherwise.
*/
[[nodiscard]]
bool
hasGasLimit() const
{
return this->sle_->isFieldPresent(sfGasLimit);
}
/**
* @brief Get sfBytecodeSizeLimit (SoeOptional)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
protocol_autogen::Optional<SF_UINT32::type::value_type>
getBytecodeSizeLimit() const
{
if (hasBytecodeSizeLimit())
return this->sle_->at(sfBytecodeSizeLimit);
return std::nullopt;
}
/**
* @brief Check if sfBytecodeSizeLimit is present.
* @return True if the field is present, false otherwise.
*/
[[nodiscard]]
bool
hasBytecodeSizeLimit() const
{
return this->sle_->isFieldPresent(sfBytecodeSizeLimit);
}
/**
* @brief Get sfGasPrice (SoeOptional)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
protocol_autogen::Optional<SF_UINT32::type::value_type>
getGasPrice() const
{
if (hasGasPrice())
return this->sle_->at(sfGasPrice);
return std::nullopt;
}
/**
* @brief Check if sfGasPrice is present.
* @return True if the field is present, false otherwise.
*/
[[nodiscard]]
bool
hasGasPrice() const
{
return this->sle_->isFieldPresent(sfGasPrice);
}
/**
* @brief Get sfPreviousTxnID (SoeOptional)
* @return The field value, or std::nullopt if not present.
@@ -375,6 +447,39 @@ public:
return *this;
}
/**
* @brief Set sfGasLimit (SoeOptional)
* @return Reference to this builder for method chaining.
*/
FeeSettingsBuilder&
setGasLimit(std::decay_t<typename SF_UINT32::type::value_type> const& value)
{
object_[sfGasLimit] = value;
return *this;
}
/**
* @brief Set sfBytecodeSizeLimit (SoeOptional)
* @return Reference to this builder for method chaining.
*/
FeeSettingsBuilder&
setBytecodeSizeLimit(std::decay_t<typename SF_UINT32::type::value_type> const& value)
{
object_[sfBytecodeSizeLimit] = value;
return *this;
}
/**
* @brief Set sfGasPrice (SoeOptional)
* @return Reference to this builder for method chaining.
*/
FeeSettingsBuilder&
setGasPrice(std::decay_t<typename SF_UINT32::type::value_type> const& value)
{
object_[sfGasPrice] = value;
return *this;
}
/**
* @brief Set sfPreviousTxnID (SoeOptional)
* @return Reference to this builder for method chaining.

View File

@@ -0,0 +1,252 @@
// 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/LedgerEntryBase.h>
#include <xrpl/protocol_autogen/LedgerEntryBuilderBase.h>
#include <xrpl/json/json_value.h>
#include <stdexcept>
#include <optional>
namespace xrpl::ledger_entries {
class FirewallBuilder;
/**
* @brief Ledger Entry: Firewall
*
* Type: ltFIREWALL (0x0085)
* RPC Name: firewall
*
* Immutable wrapper around SLE providing type-safe field access.
* Use FirewallBuilder to construct new ledger entries.
*/
class Firewall : public LedgerEntryBase
{
public:
static constexpr LedgerEntryType entryType = ltFIREWALL;
/**
* @brief Construct a Firewall ledger entry wrapper from an existing SLE object.
* @throws std::runtime_error if the ledger entry type doesn't match.
*/
explicit Firewall(SLE::const_pointer sle)
: LedgerEntryBase(std::move(sle))
{
// Verify ledger entry type
if (sle_->getType() != entryType)
{
throw std::runtime_error("Invalid ledger entry type for Firewall");
}
}
// Ledger entry-specific field getters
/**
* @brief Get sfOwner (SoeRequired)
* @return The field value.
*/
[[nodiscard]]
SF_ACCOUNT::type::value_type
getOwner() const
{
return this->sle_->at(sfOwner);
}
/**
* @brief Get sfCounterparty (SoeRequired)
* @return The field value.
*/
[[nodiscard]]
SF_ACCOUNT::type::value_type
getCounterparty() const
{
return this->sle_->at(sfCounterparty);
}
/**
* @brief Get sfMaxFee (SoeOptional)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
protocol_autogen::Optional<SF_AMOUNT::type::value_type>
getMaxFee() const
{
if (hasMaxFee())
return this->sle_->at(sfMaxFee);
return std::nullopt;
}
/**
* @brief Check if sfMaxFee is present.
* @return True if the field is present, false otherwise.
*/
[[nodiscard]]
bool
hasMaxFee() const
{
return this->sle_->isFieldPresent(sfMaxFee);
}
/**
* @brief Get sfOwnerNode (SoeRequired)
* @return The field value.
*/
[[nodiscard]]
SF_UINT64::type::value_type
getOwnerNode() const
{
return this->sle_->at(sfOwnerNode);
}
/**
* @brief Get sfPreviousTxnID (SoeRequired)
* @return The field value.
*/
[[nodiscard]]
SF_UINT256::type::value_type
getPreviousTxnID() const
{
return this->sle_->at(sfPreviousTxnID);
}
/**
* @brief Get sfPreviousTxnLgrSeq (SoeRequired)
* @return The field value.
*/
[[nodiscard]]
SF_UINT32::type::value_type
getPreviousTxnLgrSeq() const
{
return this->sle_->at(sfPreviousTxnLgrSeq);
}
};
/**
* @brief Builder for Firewall ledger entries.
*
* Provides a fluent interface for constructing ledger entries with method chaining.
* Uses STObject internally for flexible ledger entry construction.
* Inherits common field setters from LedgerEntryBuilderBase.
*/
class FirewallBuilder : public LedgerEntryBuilderBase<FirewallBuilder>
{
public:
/**
* @brief Construct a new FirewallBuilder with required fields.
* @param owner The sfOwner field value.
* @param counterparty The sfCounterparty field value.
* @param ownerNode The sfOwnerNode field value.
* @param previousTxnID The sfPreviousTxnID field value.
* @param previousTxnLgrSeq The sfPreviousTxnLgrSeq field value.
*/
FirewallBuilder(std::decay_t<typename SF_ACCOUNT::type::value_type> const& owner,std::decay_t<typename SF_ACCOUNT::type::value_type> const& counterparty,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<FirewallBuilder>(ltFIREWALL)
{
setOwner(owner);
setCounterparty(counterparty);
setOwnerNode(ownerNode);
setPreviousTxnID(previousTxnID);
setPreviousTxnLgrSeq(previousTxnLgrSeq);
}
/**
* @brief Construct a FirewallBuilder from an existing SLE object.
* @param sle The existing ledger entry to copy from.
* @throws std::runtime_error if the ledger entry type doesn't match.
*/
FirewallBuilder(SLE::const_pointer sle)
{
if (sle->at(sfLedgerEntryType) != ltFIREWALL)
{
throw std::runtime_error("Invalid ledger entry type for Firewall");
}
object_ = *sle;
}
/**
* @brief Ledger entry-specific field setters
*/
/**
* @brief Set sfOwner (SoeRequired)
* @return Reference to this builder for method chaining.
*/
FirewallBuilder&
setOwner(std::decay_t<typename SF_ACCOUNT::type::value_type> const& value)
{
object_[sfOwner] = value;
return *this;
}
/**
* @brief Set sfCounterparty (SoeRequired)
* @return Reference to this builder for method chaining.
*/
FirewallBuilder&
setCounterparty(std::decay_t<typename SF_ACCOUNT::type::value_type> const& value)
{
object_[sfCounterparty] = value;
return *this;
}
/**
* @brief Set sfMaxFee (SoeOptional)
* @return Reference to this builder for method chaining.
*/
FirewallBuilder&
setMaxFee(std::decay_t<typename SF_AMOUNT::type::value_type> const& value)
{
object_[sfMaxFee] = value;
return *this;
}
/**
* @brief Set sfOwnerNode (SoeRequired)
* @return Reference to this builder for method chaining.
*/
FirewallBuilder&
setOwnerNode(std::decay_t<typename SF_UINT64::type::value_type> const& value)
{
object_[sfOwnerNode] = value;
return *this;
}
/**
* @brief Set sfPreviousTxnID (SoeRequired)
* @return Reference to this builder for method chaining.
*/
FirewallBuilder&
setPreviousTxnID(std::decay_t<typename SF_UINT256::type::value_type> const& value)
{
object_[sfPreviousTxnID] = value;
return *this;
}
/**
* @brief Set sfPreviousTxnLgrSeq (SoeRequired)
* @return Reference to this builder for method chaining.
*/
FirewallBuilder&
setPreviousTxnLgrSeq(std::decay_t<typename SF_UINT32::type::value_type> const& value)
{
object_[sfPreviousTxnLgrSeq] = value;
return *this;
}
/**
* @brief Build and return the completed Firewall wrapper.
* @param index The ledger entry index.
* @return The constructed ledger entry wrapper.
*/
Firewall
build(uint256 const& index)
{
return Firewall{std::make_shared<SLE>(std::move(object_), index)};
}
};
} // namespace xrpl::ledger_entries

View File

@@ -291,6 +291,126 @@ public:
{
return this->sle_->isFieldPresent(sfHolderEncryptionKey);
}
/**
* @brief Get sfRedemptionAfter (SoeDefault)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
protocol_autogen::Optional<SF_UINT32::type::value_type>
getRedemptionAfter() const
{
if (hasRedemptionAfter())
return this->sle_->at(sfRedemptionAfter);
return std::nullopt;
}
/**
* @brief Check if sfRedemptionAfter is present.
* @return True if the field is present, false otherwise.
*/
[[nodiscard]]
bool
hasRedemptionAfter() const
{
return this->sle_->isFieldPresent(sfRedemptionAfter);
}
/**
* @brief Get sfCouponAccrued (SoeOptional)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
protocol_autogen::Optional<SF_AMOUNT::type::value_type>
getCouponAccrued() const
{
if (hasCouponAccrued())
return this->sle_->at(sfCouponAccrued);
return std::nullopt;
}
/**
* @brief Check if sfCouponAccrued is present.
* @return True if the field is present, false otherwise.
*/
[[nodiscard]]
bool
hasCouponAccrued() const
{
return this->sle_->isFieldPresent(sfCouponAccrued);
}
/**
* @brief Get sfCouponIndex (SoeOptional)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
protocol_autogen::Optional<SF_AMOUNT::type::value_type>
getCouponIndex() const
{
if (hasCouponIndex())
return this->sle_->at(sfCouponIndex);
return std::nullopt;
}
/**
* @brief Check if sfCouponIndex is present.
* @return True if the field is present, false otherwise.
*/
[[nodiscard]]
bool
hasCouponIndex() const
{
return this->sle_->isFieldPresent(sfCouponIndex);
}
/**
* @brief Get sfVoteLockedAmount (SoeOptional)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
protocol_autogen::Optional<SF_UINT64::type::value_type>
getVoteLockedAmount() const
{
if (hasVoteLockedAmount())
return this->sle_->at(sfVoteLockedAmount);
return std::nullopt;
}
/**
* @brief Check if sfVoteLockedAmount is present.
* @return True if the field is present, false otherwise.
*/
[[nodiscard]]
bool
hasVoteLockedAmount() const
{
return this->sle_->isFieldPresent(sfVoteLockedAmount);
}
/**
* @brief Get sfBallotID (SoeOptional)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
protocol_autogen::Optional<SF_UINT256::type::value_type>
getBallotID() const
{
if (hasBallotID())
return this->sle_->at(sfBallotID);
return std::nullopt;
}
/**
* @brief Check if sfBallotID is present.
* @return True if the field is present, false otherwise.
*/
[[nodiscard]]
bool
hasBallotID() const
{
return this->sle_->isFieldPresent(sfBallotID);
}
};
/**
@@ -482,6 +602,61 @@ public:
return *this;
}
/**
* @brief Set sfRedemptionAfter (SoeDefault)
* @return Reference to this builder for method chaining.
*/
MPTokenBuilder&
setRedemptionAfter(std::decay_t<typename SF_UINT32::type::value_type> const& value)
{
object_[sfRedemptionAfter] = value;
return *this;
}
/**
* @brief Set sfCouponAccrued (SoeOptional)
* @return Reference to this builder for method chaining.
*/
MPTokenBuilder&
setCouponAccrued(std::decay_t<typename SF_AMOUNT::type::value_type> const& value)
{
object_[sfCouponAccrued] = value;
return *this;
}
/**
* @brief Set sfCouponIndex (SoeOptional)
* @return Reference to this builder for method chaining.
*/
MPTokenBuilder&
setCouponIndex(std::decay_t<typename SF_AMOUNT::type::value_type> const& value)
{
object_[sfCouponIndex] = value;
return *this;
}
/**
* @brief Set sfVoteLockedAmount (SoeOptional)
* @return Reference to this builder for method chaining.
*/
MPTokenBuilder&
setVoteLockedAmount(std::decay_t<typename SF_UINT64::type::value_type> const& value)
{
object_[sfVoteLockedAmount] = value;
return *this;
}
/**
* @brief Set sfBallotID (SoeOptional)
* @return Reference to this builder for method chaining.
*/
MPTokenBuilder&
setBallotID(std::decay_t<typename SF_UINT256::type::value_type> const& value)
{
object_[sfBallotID] = value;
return *this;
}
/**
* @brief Build and return the completed MPToken wrapper.
* @param index The ledger entry index.

View File

@@ -209,6 +209,30 @@ public:
return this->sle_->isFieldPresent(sfMPTokenMetadata);
}
/**
* @brief Get sfMPTokenSchema (SoeOptional)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
protocol_autogen::Optional<SF_VL::type::value_type>
getMPTokenSchema() const
{
if (hasMPTokenSchema())
return this->sle_->at(sfMPTokenSchema);
return std::nullopt;
}
/**
* @brief Check if sfMPTokenSchema is present.
* @return True if the field is present, false otherwise.
*/
[[nodiscard]]
bool
hasMPTokenSchema() const
{
return this->sle_->isFieldPresent(sfMPTokenSchema);
}
/**
* @brief Get sfPreviousTxnID (SoeRequired)
* @return The field value.
@@ -351,6 +375,54 @@ public:
return this->sle_->isFieldPresent(sfAuditorEncryptionKey);
}
/**
* @brief Get sfIssuerKeyEpoch (SoeOptional)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
protocol_autogen::Optional<SF_UINT32::type::value_type>
getIssuerKeyEpoch() const
{
if (hasIssuerKeyEpoch())
return this->sle_->at(sfIssuerKeyEpoch);
return std::nullopt;
}
/**
* @brief Check if sfIssuerKeyEpoch is present.
* @return True if the field is present, false otherwise.
*/
[[nodiscard]]
bool
hasIssuerKeyEpoch() const
{
return this->sle_->isFieldPresent(sfIssuerKeyEpoch);
}
/**
* @brief Get sfAuditorKeyEpoch (SoeOptional)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
protocol_autogen::Optional<SF_UINT32::type::value_type>
getAuditorKeyEpoch() const
{
if (hasAuditorKeyEpoch())
return this->sle_->at(sfAuditorKeyEpoch);
return std::nullopt;
}
/**
* @brief Check if sfAuditorKeyEpoch is present.
* @return True if the field is present, false otherwise.
*/
[[nodiscard]]
bool
hasAuditorKeyEpoch() const
{
return this->sle_->isFieldPresent(sfAuditorKeyEpoch);
}
/**
* @brief Get sfConfidentialOutstandingAmount (SoeDefault)
* @return The field value, or std::nullopt if not present.
@@ -374,6 +446,30 @@ public:
{
return this->sle_->isFieldPresent(sfConfidentialOutstandingAmount);
}
/**
* @brief Get sfBallotID (SoeOptional)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
protocol_autogen::Optional<SF_UINT256::type::value_type>
getBallotID() const
{
if (hasBallotID())
return this->sle_->at(sfBallotID);
return std::nullopt;
}
/**
* @brief Check if sfBallotID is present.
* @return True if the field is present, false otherwise.
*/
[[nodiscard]]
bool
hasBallotID() const
{
return this->sle_->isFieldPresent(sfBallotID);
}
};
/**
@@ -523,6 +619,17 @@ public:
return *this;
}
/**
* @brief Set sfMPTokenSchema (SoeOptional)
* @return Reference to this builder for method chaining.
*/
MPTokenIssuanceBuilder&
setMPTokenSchema(std::decay_t<typename SF_VL::type::value_type> const& value)
{
object_[sfMPTokenSchema] = value;
return *this;
}
/**
* @brief Set sfPreviousTxnID (SoeRequired)
* @return Reference to this builder for method chaining.
@@ -600,6 +707,28 @@ public:
return *this;
}
/**
* @brief Set sfIssuerKeyEpoch (SoeOptional)
* @return Reference to this builder for method chaining.
*/
MPTokenIssuanceBuilder&
setIssuerKeyEpoch(std::decay_t<typename SF_UINT32::type::value_type> const& value)
{
object_[sfIssuerKeyEpoch] = value;
return *this;
}
/**
* @brief Set sfAuditorKeyEpoch (SoeOptional)
* @return Reference to this builder for method chaining.
*/
MPTokenIssuanceBuilder&
setAuditorKeyEpoch(std::decay_t<typename SF_UINT32::type::value_type> const& value)
{
object_[sfAuditorKeyEpoch] = value;
return *this;
}
/**
* @brief Set sfConfidentialOutstandingAmount (SoeDefault)
* @return Reference to this builder for method chaining.
@@ -611,6 +740,17 @@ public:
return *this;
}
/**
* @brief Set sfBallotID (SoeOptional)
* @return Reference to this builder for method chaining.
*/
MPTokenIssuanceBuilder&
setBallotID(std::decay_t<typename SF_UINT256::type::value_type> const& value)
{
object_[sfBallotID] = value;
return *this;
}
/**
* @brief Build and return the completed MPTokenIssuance wrapper.
* @param index The ledger entry index.

View File

@@ -216,6 +216,30 @@ public:
{
return this->sle_->isFieldPresent(sfAdditionalBooks);
}
/**
* @brief Get sfMinQuantity (SoeOptional)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
protocol_autogen::Optional<SF_AMOUNT::type::value_type>
getMinQuantity() const
{
if (hasMinQuantity())
return this->sle_->at(sfMinQuantity);
return std::nullopt;
}
/**
* @brief Check if sfMinQuantity is present.
* @return True if the field is present, false otherwise.
*/
[[nodiscard]]
bool
hasMinQuantity() const
{
return this->sle_->isFieldPresent(sfMinQuantity);
}
};
/**
@@ -404,6 +428,17 @@ public:
return *this;
}
/**
* @brief Set sfMinQuantity (SoeOptional)
* @return Reference to this builder for method chaining.
*/
OfferBuilder&
setMinQuantity(std::decay_t<typename SF_AMOUNT::type::value_type> const& value)
{
object_[sfMinQuantity] = value;
return *this;
}
/**
* @brief Build and return the completed Offer wrapper.
* @param index The ledger entry index.

View File

@@ -0,0 +1,218 @@
// 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/LedgerEntryBase.h>
#include <xrpl/protocol_autogen/LedgerEntryBuilderBase.h>
#include <xrpl/json/json_value.h>
#include <stdexcept>
#include <optional>
namespace xrpl::ledger_entries {
class PasskeyListBuilder;
/**
* @brief Ledger Entry: PasskeyList
*
* Type: ltPASSKEY_LIST (0x0091)
* RPC Name: passkey_list
*
* Immutable wrapper around SLE providing type-safe field access.
* Use PasskeyListBuilder to construct new ledger entries.
*/
class PasskeyList : public LedgerEntryBase
{
public:
static constexpr LedgerEntryType entryType = ltPASSKEY_LIST;
/**
* @brief Construct a PasskeyList ledger entry wrapper from an existing SLE object.
* @throws std::runtime_error if the ledger entry type doesn't match.
*/
explicit PasskeyList(SLE::const_pointer sle)
: LedgerEntryBase(std::move(sle))
{
// Verify ledger entry type
if (sle_->getType() != entryType)
{
throw std::runtime_error("Invalid ledger entry type for PasskeyList");
}
}
// Ledger entry-specific field getters
/**
* @brief Get sfPreviousTxnID (SoeRequired)
* @return The field value.
*/
[[nodiscard]]
SF_UINT256::type::value_type
getPreviousTxnID() const
{
return this->sle_->at(sfPreviousTxnID);
}
/**
* @brief Get sfPreviousTxnLgrSeq (SoeRequired)
* @return The field value.
*/
[[nodiscard]]
SF_UINT32::type::value_type
getPreviousTxnLgrSeq() const
{
return this->sle_->at(sfPreviousTxnLgrSeq);
}
/**
* @brief Get sfOwnerNode (SoeRequired)
* @return The field value.
*/
[[nodiscard]]
SF_UINT64::type::value_type
getOwnerNode() const
{
return this->sle_->at(sfOwnerNode);
}
/**
* @brief Get sfOwner (SoeRequired)
* @return The field value.
*/
[[nodiscard]]
SF_ACCOUNT::type::value_type
getOwner() const
{
return this->sle_->at(sfOwner);
}
/**
* @brief Get sfPasskeys (SoeRequired)
* @note This is an untyped field (unknown).
* @return The field value.
*/
[[nodiscard]]
STArray const&
getPasskeys() const
{
return this->sle_->getFieldArray(sfPasskeys);
}
};
/**
* @brief Builder for PasskeyList ledger entries.
*
* Provides a fluent interface for constructing ledger entries with method chaining.
* Uses STObject internally for flexible ledger entry construction.
* Inherits common field setters from LedgerEntryBuilderBase.
*/
class PasskeyListBuilder : public LedgerEntryBuilderBase<PasskeyListBuilder>
{
public:
/**
* @brief Construct a new PasskeyListBuilder with required fields.
* @param previousTxnID The sfPreviousTxnID field value.
* @param previousTxnLgrSeq The sfPreviousTxnLgrSeq field value.
* @param ownerNode The sfOwnerNode field value.
* @param owner The sfOwner field value.
* @param passkeys The sfPasskeys field value.
*/
PasskeyListBuilder(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_ACCOUNT::type::value_type> const& owner,STArray const& passkeys)
: LedgerEntryBuilderBase<PasskeyListBuilder>(ltPASSKEY_LIST)
{
setPreviousTxnID(previousTxnID);
setPreviousTxnLgrSeq(previousTxnLgrSeq);
setOwnerNode(ownerNode);
setOwner(owner);
setPasskeys(passkeys);
}
/**
* @brief Construct a PasskeyListBuilder from an existing SLE object.
* @param sle The existing ledger entry to copy from.
* @throws std::runtime_error if the ledger entry type doesn't match.
*/
PasskeyListBuilder(SLE::const_pointer sle)
{
if (sle->at(sfLedgerEntryType) != ltPASSKEY_LIST)
{
throw std::runtime_error("Invalid ledger entry type for PasskeyList");
}
object_ = *sle;
}
/**
* @brief Ledger entry-specific field setters
*/
/**
* @brief Set sfPreviousTxnID (SoeRequired)
* @return Reference to this builder for method chaining.
*/
PasskeyListBuilder&
setPreviousTxnID(std::decay_t<typename SF_UINT256::type::value_type> const& value)
{
object_[sfPreviousTxnID] = value;
return *this;
}
/**
* @brief Set sfPreviousTxnLgrSeq (SoeRequired)
* @return Reference to this builder for method chaining.
*/
PasskeyListBuilder&
setPreviousTxnLgrSeq(std::decay_t<typename SF_UINT32::type::value_type> const& value)
{
object_[sfPreviousTxnLgrSeq] = value;
return *this;
}
/**
* @brief Set sfOwnerNode (SoeRequired)
* @return Reference to this builder for method chaining.
*/
PasskeyListBuilder&
setOwnerNode(std::decay_t<typename SF_UINT64::type::value_type> const& value)
{
object_[sfOwnerNode] = value;
return *this;
}
/**
* @brief Set sfOwner (SoeRequired)
* @return Reference to this builder for method chaining.
*/
PasskeyListBuilder&
setOwner(std::decay_t<typename SF_ACCOUNT::type::value_type> const& value)
{
object_[sfOwner] = value;
return *this;
}
/**
* @brief Set sfPasskeys (SoeRequired)
* @return Reference to this builder for method chaining.
*/
PasskeyListBuilder&
setPasskeys(STArray const& value)
{
object_.setFieldArray(sfPasskeys, value);
return *this;
}
/**
* @brief Build and return the completed PasskeyList wrapper.
* @param index The ledger entry index.
* @return The constructed ledger entry wrapper.
*/
PasskeyList
build(uint256 const& index)
{
return PasskeyList{std::make_shared<SLE>(std::move(object_), index)};
}
};
} // namespace xrpl::ledger_entries

View File

@@ -287,6 +287,54 @@ public:
{
return this->sle_->isFieldPresent(sfDestinationNode);
}
/**
* @brief Get sfTransferRate (SoeOptional)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
protocol_autogen::Optional<SF_UINT32::type::value_type>
getTransferRate() const
{
if (hasTransferRate())
return this->sle_->at(sfTransferRate);
return std::nullopt;
}
/**
* @brief Check if sfTransferRate is present.
* @return True if the field is present, false otherwise.
*/
[[nodiscard]]
bool
hasTransferRate() const
{
return this->sle_->isFieldPresent(sfTransferRate);
}
/**
* @brief Get sfIssuerNode (SoeOptional)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
protocol_autogen::Optional<SF_UINT64::type::value_type>
getIssuerNode() const
{
if (hasIssuerNode())
return this->sle_->at(sfIssuerNode);
return std::nullopt;
}
/**
* @brief Check if sfIssuerNode is present.
* @return True if the field is present, false otherwise.
*/
[[nodiscard]]
bool
hasIssuerNode() const
{
return this->sle_->isFieldPresent(sfIssuerNode);
}
};
/**
@@ -508,6 +556,28 @@ public:
return *this;
}
/**
* @brief Set sfTransferRate (SoeOptional)
* @return Reference to this builder for method chaining.
*/
PayChannelBuilder&
setTransferRate(std::decay_t<typename SF_UINT32::type::value_type> const& value)
{
object_[sfTransferRate] = value;
return *this;
}
/**
* @brief Set sfIssuerNode (SoeOptional)
* @return Reference to this builder for method chaining.
*/
PayChannelBuilder&
setIssuerNode(std::decay_t<typename SF_UINT64::type::value_type> const& value)
{
object_[sfIssuerNode] = value;
return *this;
}
/**
* @brief Build and return the completed PayChannel wrapper.
* @param index The ledger entry index.

View File

@@ -0,0 +1,525 @@
// 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/LedgerEntryBase.h>
#include <xrpl/protocol_autogen/LedgerEntryBuilderBase.h>
#include <xrpl/json/json_value.h>
#include <stdexcept>
#include <optional>
namespace xrpl::ledger_entries {
class RepoBuilder;
/**
* @brief Ledger Entry: Repo
*
* Type: ltREPO (0x0095)
* RPC Name: repo
*
* Immutable wrapper around SLE providing type-safe field access.
* Use RepoBuilder to construct new ledger entries.
*/
class Repo : public LedgerEntryBase
{
public:
static constexpr LedgerEntryType entryType = ltREPO;
/**
* @brief Construct a Repo ledger entry wrapper from an existing SLE object.
* @throws std::runtime_error if the ledger entry type doesn't match.
*/
explicit Repo(SLE::const_pointer sle)
: LedgerEntryBase(std::move(sle))
{
// Verify ledger entry type
if (sle_->getType() != entryType)
{
throw std::runtime_error("Invalid ledger entry type for Repo");
}
}
// Ledger entry-specific field getters
/**
* @brief Get sfAccount (SoeRequired)
* @return The field value.
*/
[[nodiscard]]
SF_ACCOUNT::type::value_type
getAccount() const
{
return this->sle_->at(sfAccount);
}
/**
* @brief Get sfCounterparty (SoeRequired)
* @return The field value.
*/
[[nodiscard]]
SF_ACCOUNT::type::value_type
getCounterparty() const
{
return this->sle_->at(sfCounterparty);
}
/**
* @brief Get sfCollateralAmount (SoeRequired)
* @return The field value.
*/
[[nodiscard]]
SF_AMOUNT::type::value_type
getCollateralAmount() const
{
return this->sle_->at(sfCollateralAmount);
}
/**
* @brief Get sfPurchasePrice (SoeRequired)
* @return The field value.
*/
[[nodiscard]]
SF_AMOUNT::type::value_type
getPurchasePrice() const
{
return this->sle_->at(sfPurchasePrice);
}
/**
* @brief Get sfInterestRate (SoeRequired)
* @return The field value.
*/
[[nodiscard]]
SF_UINT32::type::value_type
getInterestRate() const
{
return this->sle_->at(sfInterestRate);
}
/**
* @brief Get sfExpiration (SoeRequired)
* @return The field value.
*/
[[nodiscard]]
SF_UINT32::type::value_type
getExpiration() const
{
return this->sle_->at(sfExpiration);
}
/**
* @brief Get sfStartDate (SoeOptional)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
protocol_autogen::Optional<SF_UINT32::type::value_type>
getStartDate() const
{
if (hasStartDate())
return this->sle_->at(sfStartDate);
return std::nullopt;
}
/**
* @brief Check if sfStartDate is present.
* @return True if the field is present, false otherwise.
*/
[[nodiscard]]
bool
hasStartDate() const
{
return this->sle_->isFieldPresent(sfStartDate);
}
/**
* @brief Get sfMaturityDate (SoeRequired)
* @return The field value.
*/
[[nodiscard]]
SF_UINT32::type::value_type
getMaturityDate() const
{
return this->sle_->at(sfMaturityDate);
}
/**
* @brief Get sfGracePeriod (SoeRequired)
* @return The field value.
*/
[[nodiscard]]
SF_UINT32::type::value_type
getGracePeriod() const
{
return this->sle_->at(sfGracePeriod);
}
/**
* @brief Get sfTransferRate (SoeOptional)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
protocol_autogen::Optional<SF_UINT32::type::value_type>
getTransferRate() const
{
if (hasTransferRate())
return this->sle_->at(sfTransferRate);
return std::nullopt;
}
/**
* @brief Check if sfTransferRate is present.
* @return True if the field is present, false otherwise.
*/
[[nodiscard]]
bool
hasTransferRate() const
{
return this->sle_->isFieldPresent(sfTransferRate);
}
/**
* @brief Get sfData (SoeOptional)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
protocol_autogen::Optional<SF_VL::type::value_type>
getData() const
{
if (hasData())
return this->sle_->at(sfData);
return std::nullopt;
}
/**
* @brief Check if sfData is present.
* @return True if the field is present, false otherwise.
*/
[[nodiscard]]
bool
hasData() const
{
return this->sle_->isFieldPresent(sfData);
}
/**
* @brief Get sfOwnerNode (SoeRequired)
* @return The field value.
*/
[[nodiscard]]
SF_UINT64::type::value_type
getOwnerNode() const
{
return this->sle_->at(sfOwnerNode);
}
/**
* @brief Get sfDestinationNode (SoeRequired)
* @return The field value.
*/
[[nodiscard]]
SF_UINT64::type::value_type
getDestinationNode() const
{
return this->sle_->at(sfDestinationNode);
}
/**
* @brief Get sfIssuerNode (SoeOptional)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
protocol_autogen::Optional<SF_UINT64::type::value_type>
getIssuerNode() const
{
if (hasIssuerNode())
return this->sle_->at(sfIssuerNode);
return std::nullopt;
}
/**
* @brief Check if sfIssuerNode is present.
* @return True if the field is present, false otherwise.
*/
[[nodiscard]]
bool
hasIssuerNode() const
{
return this->sle_->isFieldPresent(sfIssuerNode);
}
/**
* @brief Get sfPreviousTxnID (SoeRequired)
* @return The field value.
*/
[[nodiscard]]
SF_UINT256::type::value_type
getPreviousTxnID() const
{
return this->sle_->at(sfPreviousTxnID);
}
/**
* @brief Get sfPreviousTxnLgrSeq (SoeRequired)
* @return The field value.
*/
[[nodiscard]]
SF_UINT32::type::value_type
getPreviousTxnLgrSeq() const
{
return this->sle_->at(sfPreviousTxnLgrSeq);
}
};
/**
* @brief Builder for Repo ledger entries.
*
* Provides a fluent interface for constructing ledger entries with method chaining.
* Uses STObject internally for flexible ledger entry construction.
* Inherits common field setters from LedgerEntryBuilderBase.
*/
class RepoBuilder : public LedgerEntryBuilderBase<RepoBuilder>
{
public:
/**
* @brief Construct a new RepoBuilder with required fields.
* @param account The sfAccount field value.
* @param counterparty The sfCounterparty field value.
* @param collateralAmount The sfCollateralAmount field value.
* @param purchasePrice The sfPurchasePrice field value.
* @param interestRate The sfInterestRate field value.
* @param expiration The sfExpiration field value.
* @param maturityDate The sfMaturityDate field value.
* @param gracePeriod The sfGracePeriod field value.
* @param ownerNode The sfOwnerNode field value.
* @param destinationNode The sfDestinationNode field value.
* @param previousTxnID The sfPreviousTxnID field value.
* @param previousTxnLgrSeq The sfPreviousTxnLgrSeq field value.
*/
RepoBuilder(std::decay_t<typename SF_ACCOUNT::type::value_type> const& account,std::decay_t<typename SF_ACCOUNT::type::value_type> const& counterparty,std::decay_t<typename SF_AMOUNT::type::value_type> const& collateralAmount,std::decay_t<typename SF_AMOUNT::type::value_type> const& purchasePrice,std::decay_t<typename SF_UINT32::type::value_type> const& interestRate,std::decay_t<typename SF_UINT32::type::value_type> const& expiration,std::decay_t<typename SF_UINT32::type::value_type> const& maturityDate,std::decay_t<typename SF_UINT32::type::value_type> const& gracePeriod,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<RepoBuilder>(ltREPO)
{
setAccount(account);
setCounterparty(counterparty);
setCollateralAmount(collateralAmount);
setPurchasePrice(purchasePrice);
setInterestRate(interestRate);
setExpiration(expiration);
setMaturityDate(maturityDate);
setGracePeriod(gracePeriod);
setOwnerNode(ownerNode);
setDestinationNode(destinationNode);
setPreviousTxnID(previousTxnID);
setPreviousTxnLgrSeq(previousTxnLgrSeq);
}
/**
* @brief Construct a RepoBuilder from an existing SLE object.
* @param sle The existing ledger entry to copy from.
* @throws std::runtime_error if the ledger entry type doesn't match.
*/
RepoBuilder(SLE::const_pointer sle)
{
if (sle->at(sfLedgerEntryType) != ltREPO)
{
throw std::runtime_error("Invalid ledger entry type for Repo");
}
object_ = *sle;
}
/**
* @brief Ledger entry-specific field setters
*/
/**
* @brief Set sfAccount (SoeRequired)
* @return Reference to this builder for method chaining.
*/
RepoBuilder&
setAccount(std::decay_t<typename SF_ACCOUNT::type::value_type> const& value)
{
object_[sfAccount] = value;
return *this;
}
/**
* @brief Set sfCounterparty (SoeRequired)
* @return Reference to this builder for method chaining.
*/
RepoBuilder&
setCounterparty(std::decay_t<typename SF_ACCOUNT::type::value_type> const& value)
{
object_[sfCounterparty] = value;
return *this;
}
/**
* @brief Set sfCollateralAmount (SoeRequired)
* @return Reference to this builder for method chaining.
*/
RepoBuilder&
setCollateralAmount(std::decay_t<typename SF_AMOUNT::type::value_type> const& value)
{
object_[sfCollateralAmount] = value;
return *this;
}
/**
* @brief Set sfPurchasePrice (SoeRequired)
* @return Reference to this builder for method chaining.
*/
RepoBuilder&
setPurchasePrice(std::decay_t<typename SF_AMOUNT::type::value_type> const& value)
{
object_[sfPurchasePrice] = value;
return *this;
}
/**
* @brief Set sfInterestRate (SoeRequired)
* @return Reference to this builder for method chaining.
*/
RepoBuilder&
setInterestRate(std::decay_t<typename SF_UINT32::type::value_type> const& value)
{
object_[sfInterestRate] = value;
return *this;
}
/**
* @brief Set sfExpiration (SoeRequired)
* @return Reference to this builder for method chaining.
*/
RepoBuilder&
setExpiration(std::decay_t<typename SF_UINT32::type::value_type> const& value)
{
object_[sfExpiration] = value;
return *this;
}
/**
* @brief Set sfStartDate (SoeOptional)
* @return Reference to this builder for method chaining.
*/
RepoBuilder&
setStartDate(std::decay_t<typename SF_UINT32::type::value_type> const& value)
{
object_[sfStartDate] = value;
return *this;
}
/**
* @brief Set sfMaturityDate (SoeRequired)
* @return Reference to this builder for method chaining.
*/
RepoBuilder&
setMaturityDate(std::decay_t<typename SF_UINT32::type::value_type> const& value)
{
object_[sfMaturityDate] = value;
return *this;
}
/**
* @brief Set sfGracePeriod (SoeRequired)
* @return Reference to this builder for method chaining.
*/
RepoBuilder&
setGracePeriod(std::decay_t<typename SF_UINT32::type::value_type> const& value)
{
object_[sfGracePeriod] = value;
return *this;
}
/**
* @brief Set sfTransferRate (SoeOptional)
* @return Reference to this builder for method chaining.
*/
RepoBuilder&
setTransferRate(std::decay_t<typename SF_UINT32::type::value_type> const& value)
{
object_[sfTransferRate] = value;
return *this;
}
/**
* @brief Set sfData (SoeOptional)
* @return Reference to this builder for method chaining.
*/
RepoBuilder&
setData(std::decay_t<typename SF_VL::type::value_type> const& value)
{
object_[sfData] = value;
return *this;
}
/**
* @brief Set sfOwnerNode (SoeRequired)
* @return Reference to this builder for method chaining.
*/
RepoBuilder&
setOwnerNode(std::decay_t<typename SF_UINT64::type::value_type> const& value)
{
object_[sfOwnerNode] = value;
return *this;
}
/**
* @brief Set sfDestinationNode (SoeRequired)
* @return Reference to this builder for method chaining.
*/
RepoBuilder&
setDestinationNode(std::decay_t<typename SF_UINT64::type::value_type> const& value)
{
object_[sfDestinationNode] = value;
return *this;
}
/**
* @brief Set sfIssuerNode (SoeOptional)
* @return Reference to this builder for method chaining.
*/
RepoBuilder&
setIssuerNode(std::decay_t<typename SF_UINT64::type::value_type> const& value)
{
object_[sfIssuerNode] = value;
return *this;
}
/**
* @brief Set sfPreviousTxnID (SoeRequired)
* @return Reference to this builder for method chaining.
*/
RepoBuilder&
setPreviousTxnID(std::decay_t<typename SF_UINT256::type::value_type> const& value)
{
object_[sfPreviousTxnID] = value;
return *this;
}
/**
* @brief Set sfPreviousTxnLgrSeq (SoeRequired)
* @return Reference to this builder for method chaining.
*/
RepoBuilder&
setPreviousTxnLgrSeq(std::decay_t<typename SF_UINT32::type::value_type> const& value)
{
object_[sfPreviousTxnLgrSeq] = value;
return *this;
}
/**
* @brief Build and return the completed Repo wrapper.
* @param index The ledger entry index.
* @return The constructed ledger entry wrapper.
*/
Repo
build(uint256 const& index)
{
return Repo{std::make_shared<SLE>(std::move(object_), index)};
}
};
} // namespace xrpl::ledger_entries

View File

@@ -0,0 +1,431 @@
// 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/LedgerEntryBase.h>
#include <xrpl/protocol_autogen/LedgerEntryBuilderBase.h>
#include <xrpl/json/json_value.h>
#include <stdexcept>
#include <optional>
namespace xrpl::ledger_entries {
class SubscriptionBuilder;
/**
* @brief Ledger Entry: Subscription
*
* Type: ltSUBSCRIPTION (0x008A)
* RPC Name: subscription
*
* Immutable wrapper around SLE providing type-safe field access.
* Use SubscriptionBuilder to construct new ledger entries.
*/
class Subscription : public LedgerEntryBase
{
public:
static constexpr LedgerEntryType entryType = ltSUBSCRIPTION;
/**
* @brief Construct a Subscription ledger entry wrapper from an existing SLE object.
* @throws std::runtime_error if the ledger entry type doesn't match.
*/
explicit Subscription(SLE::const_pointer sle)
: LedgerEntryBase(std::move(sle))
{
// Verify ledger entry type
if (sle_->getType() != entryType)
{
throw std::runtime_error("Invalid ledger entry type for Subscription");
}
}
// Ledger entry-specific field getters
/**
* @brief Get sfPreviousTxnID (SoeRequired)
* @return The field value.
*/
[[nodiscard]]
SF_UINT256::type::value_type
getPreviousTxnID() const
{
return this->sle_->at(sfPreviousTxnID);
}
/**
* @brief Get sfPreviousTxnLgrSeq (SoeRequired)
* @return The field value.
*/
[[nodiscard]]
SF_UINT32::type::value_type
getPreviousTxnLgrSeq() const
{
return this->sle_->at(sfPreviousTxnLgrSeq);
}
/**
* @brief Get sfSequence (SoeRequired)
* @return The field value.
*/
[[nodiscard]]
SF_UINT32::type::value_type
getSequence() const
{
return this->sle_->at(sfSequence);
}
/**
* @brief Get sfOwnerNode (SoeRequired)
* @return The field value.
*/
[[nodiscard]]
SF_UINT64::type::value_type
getOwnerNode() const
{
return this->sle_->at(sfOwnerNode);
}
/**
* @brief Get sfAccount (SoeRequired)
* @return The field value.
*/
[[nodiscard]]
SF_ACCOUNT::type::value_type
getAccount() const
{
return this->sle_->at(sfAccount);
}
/**
* @brief Get sfDestination (SoeRequired)
* @return The field value.
*/
[[nodiscard]]
SF_ACCOUNT::type::value_type
getDestination() const
{
return this->sle_->at(sfDestination);
}
/**
* @brief Get sfDestinationTag (SoeOptional)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
protocol_autogen::Optional<SF_UINT32::type::value_type>
getDestinationTag() const
{
if (hasDestinationTag())
return this->sle_->at(sfDestinationTag);
return std::nullopt;
}
/**
* @brief Check if sfDestinationTag is present.
* @return True if the field is present, false otherwise.
*/
[[nodiscard]]
bool
hasDestinationTag() const
{
return this->sle_->isFieldPresent(sfDestinationTag);
}
/**
* @brief Get sfAmount (SoeRequired)
* @return The field value.
*/
[[nodiscard]]
SF_AMOUNT::type::value_type
getAmount() const
{
return this->sle_->at(sfAmount);
}
/**
* @brief Get sfBalance (SoeRequired)
* @return The field value.
*/
[[nodiscard]]
SF_AMOUNT::type::value_type
getBalance() const
{
return this->sle_->at(sfBalance);
}
/**
* @brief Get sfFrequency (SoeRequired)
* @return The field value.
*/
[[nodiscard]]
SF_UINT32::type::value_type
getFrequency() const
{
return this->sle_->at(sfFrequency);
}
/**
* @brief Get sfNextClaimTime (SoeRequired)
* @return The field value.
*/
[[nodiscard]]
SF_UINT32::type::value_type
getNextClaimTime() const
{
return this->sle_->at(sfNextClaimTime);
}
/**
* @brief Get sfExpiration (SoeOptional)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
protocol_autogen::Optional<SF_UINT32::type::value_type>
getExpiration() const
{
if (hasExpiration())
return this->sle_->at(sfExpiration);
return std::nullopt;
}
/**
* @brief Check if sfExpiration is present.
* @return True if the field is present, false otherwise.
*/
[[nodiscard]]
bool
hasExpiration() const
{
return this->sle_->isFieldPresent(sfExpiration);
}
/**
* @brief Get sfDestinationNode (SoeRequired)
* @return The field value.
*/
[[nodiscard]]
SF_UINT64::type::value_type
getDestinationNode() const
{
return this->sle_->at(sfDestinationNode);
}
};
/**
* @brief Builder for Subscription ledger entries.
*
* Provides a fluent interface for constructing ledger entries with method chaining.
* Uses STObject internally for flexible ledger entry construction.
* Inherits common field setters from LedgerEntryBuilderBase.
*/
class SubscriptionBuilder : public LedgerEntryBuilderBase<SubscriptionBuilder>
{
public:
/**
* @brief Construct a new SubscriptionBuilder with required fields.
* @param previousTxnID The sfPreviousTxnID field value.
* @param previousTxnLgrSeq The sfPreviousTxnLgrSeq field value.
* @param sequence The sfSequence field value.
* @param ownerNode The sfOwnerNode field value.
* @param account The sfAccount field value.
* @param destination The sfDestination field value.
* @param amount The sfAmount field value.
* @param balance The sfBalance field value.
* @param frequency The sfFrequency field value.
* @param nextClaimTime The sfNextClaimTime field value.
* @param destinationNode The sfDestinationNode field value.
*/
SubscriptionBuilder(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& 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_UINT32::type::value_type> const& frequency,std::decay_t<typename SF_UINT32::type::value_type> const& nextClaimTime,std::decay_t<typename SF_UINT64::type::value_type> const& destinationNode)
: LedgerEntryBuilderBase<SubscriptionBuilder>(ltSUBSCRIPTION)
{
setPreviousTxnID(previousTxnID);
setPreviousTxnLgrSeq(previousTxnLgrSeq);
setSequence(sequence);
setOwnerNode(ownerNode);
setAccount(account);
setDestination(destination);
setAmount(amount);
setBalance(balance);
setFrequency(frequency);
setNextClaimTime(nextClaimTime);
setDestinationNode(destinationNode);
}
/**
* @brief Construct a SubscriptionBuilder from an existing SLE object.
* @param sle The existing ledger entry to copy from.
* @throws std::runtime_error if the ledger entry type doesn't match.
*/
SubscriptionBuilder(SLE::const_pointer sle)
{
if (sle->at(sfLedgerEntryType) != ltSUBSCRIPTION)
{
throw std::runtime_error("Invalid ledger entry type for Subscription");
}
object_ = *sle;
}
/**
* @brief Ledger entry-specific field setters
*/
/**
* @brief Set sfPreviousTxnID (SoeRequired)
* @return Reference to this builder for method chaining.
*/
SubscriptionBuilder&
setPreviousTxnID(std::decay_t<typename SF_UINT256::type::value_type> const& value)
{
object_[sfPreviousTxnID] = value;
return *this;
}
/**
* @brief Set sfPreviousTxnLgrSeq (SoeRequired)
* @return Reference to this builder for method chaining.
*/
SubscriptionBuilder&
setPreviousTxnLgrSeq(std::decay_t<typename SF_UINT32::type::value_type> const& value)
{
object_[sfPreviousTxnLgrSeq] = value;
return *this;
}
/**
* @brief Set sfSequence (SoeRequired)
* @return Reference to this builder for method chaining.
*/
SubscriptionBuilder&
setSequence(std::decay_t<typename SF_UINT32::type::value_type> const& value)
{
object_[sfSequence] = value;
return *this;
}
/**
* @brief Set sfOwnerNode (SoeRequired)
* @return Reference to this builder for method chaining.
*/
SubscriptionBuilder&
setOwnerNode(std::decay_t<typename SF_UINT64::type::value_type> const& value)
{
object_[sfOwnerNode] = value;
return *this;
}
/**
* @brief Set sfAccount (SoeRequired)
* @return Reference to this builder for method chaining.
*/
SubscriptionBuilder&
setAccount(std::decay_t<typename SF_ACCOUNT::type::value_type> const& value)
{
object_[sfAccount] = value;
return *this;
}
/**
* @brief Set sfDestination (SoeRequired)
* @return Reference to this builder for method chaining.
*/
SubscriptionBuilder&
setDestination(std::decay_t<typename SF_ACCOUNT::type::value_type> const& value)
{
object_[sfDestination] = value;
return *this;
}
/**
* @brief Set sfDestinationTag (SoeOptional)
* @return Reference to this builder for method chaining.
*/
SubscriptionBuilder&
setDestinationTag(std::decay_t<typename SF_UINT32::type::value_type> const& value)
{
object_[sfDestinationTag] = value;
return *this;
}
/**
* @brief Set sfAmount (SoeRequired)
* @return Reference to this builder for method chaining.
*/
SubscriptionBuilder&
setAmount(std::decay_t<typename SF_AMOUNT::type::value_type> const& value)
{
object_[sfAmount] = value;
return *this;
}
/**
* @brief Set sfBalance (SoeRequired)
* @return Reference to this builder for method chaining.
*/
SubscriptionBuilder&
setBalance(std::decay_t<typename SF_AMOUNT::type::value_type> const& value)
{
object_[sfBalance] = value;
return *this;
}
/**
* @brief Set sfFrequency (SoeRequired)
* @return Reference to this builder for method chaining.
*/
SubscriptionBuilder&
setFrequency(std::decay_t<typename SF_UINT32::type::value_type> const& value)
{
object_[sfFrequency] = value;
return *this;
}
/**
* @brief Set sfNextClaimTime (SoeRequired)
* @return Reference to this builder for method chaining.
*/
SubscriptionBuilder&
setNextClaimTime(std::decay_t<typename SF_UINT32::type::value_type> const& value)
{
object_[sfNextClaimTime] = value;
return *this;
}
/**
* @brief Set sfExpiration (SoeOptional)
* @return Reference to this builder for method chaining.
*/
SubscriptionBuilder&
setExpiration(std::decay_t<typename SF_UINT32::type::value_type> const& value)
{
object_[sfExpiration] = value;
return *this;
}
/**
* @brief Set sfDestinationNode (SoeRequired)
* @return Reference to this builder for method chaining.
*/
SubscriptionBuilder&
setDestinationNode(std::decay_t<typename SF_UINT64::type::value_type> const& value)
{
object_[sfDestinationNode] = value;
return *this;
}
/**
* @brief Build and return the completed Subscription wrapper.
* @param index The ledger entry index.
* @return The constructed ledger entry wrapper.
*/
Subscription
build(uint256 const& index)
{
return Subscription{std::make_shared<SLE>(std::move(object_), index)};
}
};
} // namespace xrpl::ledger_entries

View File

@@ -242,6 +242,78 @@ public:
return this->sle_->isFieldPresent(sfLossUnrealized);
}
/**
* @brief Get sfUnearnedInterest (SoeDefault)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
protocol_autogen::Optional<SF_NUMBER::type::value_type>
getUnearnedInterest() const
{
if (hasUnearnedInterest())
return this->sle_->at(sfUnearnedInterest);
return std::nullopt;
}
/**
* @brief Check if sfUnearnedInterest is present.
* @return True if the field is present, false otherwise.
*/
[[nodiscard]]
bool
hasUnearnedInterest() const
{
return this->sle_->isFieldPresent(sfUnearnedInterest);
}
/**
* @brief Get sfAccrualRate (SoeDefault)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
protocol_autogen::Optional<SF_NUMBER::type::value_type>
getAccrualRate() const
{
if (hasAccrualRate())
return this->sle_->at(sfAccrualRate);
return std::nullopt;
}
/**
* @brief Check if sfAccrualRate is present.
* @return True if the field is present, false otherwise.
*/
[[nodiscard]]
bool
hasAccrualRate() const
{
return this->sle_->isFieldPresent(sfAccrualRate);
}
/**
* @brief Get sfLastAccrualTime (SoeDefault)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
protocol_autogen::Optional<SF_UINT32::type::value_type>
getLastAccrualTime() const
{
if (hasLastAccrualTime())
return this->sle_->at(sfLastAccrualTime);
return std::nullopt;
}
/**
* @brief Check if sfLastAccrualTime is present.
* @return True if the field is present, false otherwise.
*/
[[nodiscard]]
bool
hasLastAccrualTime() const
{
return this->sle_->isFieldPresent(sfLastAccrualTime);
}
/**
* @brief Get sfShareMPTID (SoeRequired)
* @return The field value.
@@ -264,6 +336,30 @@ public:
return this->sle_->at(sfWithdrawalPolicy);
}
/**
* @brief Get sfAccountingMethod (SoeDefault)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
protocol_autogen::Optional<SF_UINT8::type::value_type>
getAccountingMethod() const
{
if (hasAccountingMethod())
return this->sle_->at(sfAccountingMethod);
return std::nullopt;
}
/**
* @brief Check if sfAccountingMethod is present.
* @return True if the field is present, false otherwise.
*/
[[nodiscard]]
bool
hasAccountingMethod() const
{
return this->sle_->isFieldPresent(sfAccountingMethod);
}
/**
* @brief Get sfScale (SoeDefault)
* @return The field value, or std::nullopt if not present.
@@ -571,6 +667,39 @@ public:
return *this;
}
/**
* @brief Set sfUnearnedInterest (SoeDefault)
* @return Reference to this builder for method chaining.
*/
VaultBuilder&
setUnearnedInterest(std::decay_t<typename SF_NUMBER::type::value_type> const& value)
{
object_[sfUnearnedInterest] = value;
return *this;
}
/**
* @brief Set sfAccrualRate (SoeDefault)
* @return Reference to this builder for method chaining.
*/
VaultBuilder&
setAccrualRate(std::decay_t<typename SF_NUMBER::type::value_type> const& value)
{
object_[sfAccrualRate] = value;
return *this;
}
/**
* @brief Set sfLastAccrualTime (SoeDefault)
* @return Reference to this builder for method chaining.
*/
VaultBuilder&
setLastAccrualTime(std::decay_t<typename SF_UINT32::type::value_type> const& value)
{
object_[sfLastAccrualTime] = value;
return *this;
}
/**
* @brief Set sfShareMPTID (SoeRequired)
* @return Reference to this builder for method chaining.
@@ -593,6 +722,17 @@ public:
return *this;
}
/**
* @brief Set sfAccountingMethod (SoeDefault)
* @return Reference to this builder for method chaining.
*/
VaultBuilder&
setAccountingMethod(std::decay_t<typename SF_UINT8::type::value_type> const& value)
{
object_[sfAccountingMethod] = value;
return *this;
}
/**
* @brief Set sfScale (SoeDefault)
* @return Reference to this builder for method chaining.

View File

@@ -0,0 +1,252 @@
// 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/LedgerEntryBase.h>
#include <xrpl/protocol_autogen/LedgerEntryBuilderBase.h>
#include <xrpl/json/json_value.h>
#include <stdexcept>
#include <optional>
namespace xrpl::ledger_entries {
class WithdrawPreauthBuilder;
/**
* @brief Ledger Entry: WithdrawPreauth
*
* Type: ltWITHDRAW_PREAUTH (0x0086)
* RPC Name: withdraw_preauth
*
* Immutable wrapper around SLE providing type-safe field access.
* Use WithdrawPreauthBuilder to construct new ledger entries.
*/
class WithdrawPreauth : public LedgerEntryBase
{
public:
static constexpr LedgerEntryType entryType = ltWITHDRAW_PREAUTH;
/**
* @brief Construct a WithdrawPreauth ledger entry wrapper from an existing SLE object.
* @throws std::runtime_error if the ledger entry type doesn't match.
*/
explicit WithdrawPreauth(SLE::const_pointer sle)
: LedgerEntryBase(std::move(sle))
{
// Verify ledger entry type
if (sle_->getType() != entryType)
{
throw std::runtime_error("Invalid ledger entry type for WithdrawPreauth");
}
}
// Ledger entry-specific field getters
/**
* @brief Get sfAccount (SoeRequired)
* @return The field value.
*/
[[nodiscard]]
SF_ACCOUNT::type::value_type
getAccount() const
{
return this->sle_->at(sfAccount);
}
/**
* @brief Get sfAuthorize (SoeRequired)
* @return The field value.
*/
[[nodiscard]]
SF_ACCOUNT::type::value_type
getAuthorize() const
{
return this->sle_->at(sfAuthorize);
}
/**
* @brief Get sfDestinationTag (SoeOptional)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
protocol_autogen::Optional<SF_UINT32::type::value_type>
getDestinationTag() const
{
if (hasDestinationTag())
return this->sle_->at(sfDestinationTag);
return std::nullopt;
}
/**
* @brief Check if sfDestinationTag is present.
* @return True if the field is present, false otherwise.
*/
[[nodiscard]]
bool
hasDestinationTag() const
{
return this->sle_->isFieldPresent(sfDestinationTag);
}
/**
* @brief Get sfOwnerNode (SoeRequired)
* @return The field value.
*/
[[nodiscard]]
SF_UINT64::type::value_type
getOwnerNode() const
{
return this->sle_->at(sfOwnerNode);
}
/**
* @brief Get sfPreviousTxnID (SoeRequired)
* @return The field value.
*/
[[nodiscard]]
SF_UINT256::type::value_type
getPreviousTxnID() const
{
return this->sle_->at(sfPreviousTxnID);
}
/**
* @brief Get sfPreviousTxnLgrSeq (SoeRequired)
* @return The field value.
*/
[[nodiscard]]
SF_UINT32::type::value_type
getPreviousTxnLgrSeq() const
{
return this->sle_->at(sfPreviousTxnLgrSeq);
}
};
/**
* @brief Builder for WithdrawPreauth ledger entries.
*
* Provides a fluent interface for constructing ledger entries with method chaining.
* Uses STObject internally for flexible ledger entry construction.
* Inherits common field setters from LedgerEntryBuilderBase.
*/
class WithdrawPreauthBuilder : public LedgerEntryBuilderBase<WithdrawPreauthBuilder>
{
public:
/**
* @brief Construct a new WithdrawPreauthBuilder with required fields.
* @param account The sfAccount field value.
* @param authorize The sfAuthorize field value.
* @param ownerNode The sfOwnerNode field value.
* @param previousTxnID The sfPreviousTxnID field value.
* @param previousTxnLgrSeq The sfPreviousTxnLgrSeq field value.
*/
WithdrawPreauthBuilder(std::decay_t<typename SF_ACCOUNT::type::value_type> const& account,std::decay_t<typename SF_ACCOUNT::type::value_type> const& authorize,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<WithdrawPreauthBuilder>(ltWITHDRAW_PREAUTH)
{
setAccount(account);
setAuthorize(authorize);
setOwnerNode(ownerNode);
setPreviousTxnID(previousTxnID);
setPreviousTxnLgrSeq(previousTxnLgrSeq);
}
/**
* @brief Construct a WithdrawPreauthBuilder from an existing SLE object.
* @param sle The existing ledger entry to copy from.
* @throws std::runtime_error if the ledger entry type doesn't match.
*/
WithdrawPreauthBuilder(SLE::const_pointer sle)
{
if (sle->at(sfLedgerEntryType) != ltWITHDRAW_PREAUTH)
{
throw std::runtime_error("Invalid ledger entry type for WithdrawPreauth");
}
object_ = *sle;
}
/**
* @brief Ledger entry-specific field setters
*/
/**
* @brief Set sfAccount (SoeRequired)
* @return Reference to this builder for method chaining.
*/
WithdrawPreauthBuilder&
setAccount(std::decay_t<typename SF_ACCOUNT::type::value_type> const& value)
{
object_[sfAccount] = value;
return *this;
}
/**
* @brief Set sfAuthorize (SoeRequired)
* @return Reference to this builder for method chaining.
*/
WithdrawPreauthBuilder&
setAuthorize(std::decay_t<typename SF_ACCOUNT::type::value_type> const& value)
{
object_[sfAuthorize] = value;
return *this;
}
/**
* @brief Set sfDestinationTag (SoeOptional)
* @return Reference to this builder for method chaining.
*/
WithdrawPreauthBuilder&
setDestinationTag(std::decay_t<typename SF_UINT32::type::value_type> const& value)
{
object_[sfDestinationTag] = value;
return *this;
}
/**
* @brief Set sfOwnerNode (SoeRequired)
* @return Reference to this builder for method chaining.
*/
WithdrawPreauthBuilder&
setOwnerNode(std::decay_t<typename SF_UINT64::type::value_type> const& value)
{
object_[sfOwnerNode] = value;
return *this;
}
/**
* @brief Set sfPreviousTxnID (SoeRequired)
* @return Reference to this builder for method chaining.
*/
WithdrawPreauthBuilder&
setPreviousTxnID(std::decay_t<typename SF_UINT256::type::value_type> const& value)
{
object_[sfPreviousTxnID] = value;
return *this;
}
/**
* @brief Set sfPreviousTxnLgrSeq (SoeRequired)
* @return Reference to this builder for method chaining.
*/
WithdrawPreauthBuilder&
setPreviousTxnLgrSeq(std::decay_t<typename SF_UINT32::type::value_type> const& value)
{
object_[sfPreviousTxnLgrSeq] = value;
return *this;
}
/**
* @brief Build and return the completed WithdrawPreauth wrapper.
* @param index The ledger entry index.
* @return The constructed ledger entry wrapper.
*/
WithdrawPreauth
build(uint256 const& index)
{
return WithdrawPreauth{std::make_shared<SLE>(std::move(object_), index)};
}
};
} // namespace xrpl::ledger_entries

View File

@@ -71,6 +71,32 @@ public:
return this->tx_->at(sfAsset2);
}
/**
* @brief Get sfCurveType (SoeOptional)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
protocol_autogen::Optional<SF_UINT8::type::value_type>
getCurveType() const
{
if (hasCurveType())
{
return this->tx_->at(sfCurveType);
}
return std::nullopt;
}
/**
* @brief Check if sfCurveType is present.
* @return True if the field is present, false otherwise.
*/
[[nodiscard]]
bool
hasCurveType() const
{
return this->tx_->isFieldPresent(sfCurveType);
}
/**
* @brief Get sfBidMin (SoeOptional)
* @return The field value, or std::nullopt if not present.
@@ -218,6 +244,17 @@ public:
return *this;
}
/**
* @brief Set sfCurveType (SoeOptional)
* @return Reference to this builder for method chaining.
*/
AMMBidBuilder&
setCurveType(std::decay_t<typename SF_UINT8::type::value_type> const& value)
{
object_[sfCurveType] = value;
return *this;
}
/**
* @brief Set sfBidMin (SoeOptional)
* @return Reference to this builder for method chaining.

View File

@@ -0,0 +1,183 @@
// 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/TransactionBase.h>
#include <xrpl/protocol_autogen/TransactionBuilderBase.h>
#include <xrpl/json/json_value.h>
#include <stdexcept>
#include <optional>
namespace xrpl::transactions {
class AMMBinCreateBuilder;
/**
* @brief Transaction: AMMBinCreate
*
* Type: ttAMM_BIN_CREATE (110)
* Delegable: Delegation::Delegable
* Amendment: featureAMMCurves
* Privileges: Privilege::CreateMptIssuance
*
* Immutable wrapper around STTx providing type-safe field access.
* Use AMMBinCreateBuilder to construct new transactions.
*/
class AMMBinCreate : public TransactionBase
{
public:
static constexpr xrpl::TxType txType = ttAMM_BIN_CREATE;
/**
* @brief Construct a AMMBinCreate transaction wrapper from an existing STTx object.
* @throws std::runtime_error if the transaction type doesn't match.
*/
explicit AMMBinCreate(std::shared_ptr<STTx const> tx)
: TransactionBase(std::move(tx))
{
// Verify transaction type
if (tx_->getTxnType() != txType)
{
throw std::runtime_error("Invalid transaction type for AMMBinCreate");
}
}
// Transaction-specific field getters
/**
* @brief Get sfAsset (SoeRequired)
* @note This field supports MPT (Multi-Purpose Token) amounts.
* @return The field value.
*/
[[nodiscard]]
SF_ISSUE::type::value_type
getAsset() const
{
return this->tx_->at(sfAsset);
}
/**
* @brief Get sfAsset2 (SoeRequired)
* @note This field supports MPT (Multi-Purpose Token) amounts.
* @return The field value.
*/
[[nodiscard]]
SF_ISSUE::type::value_type
getAsset2() const
{
return this->tx_->at(sfAsset2);
}
/**
* @brief Get sfBinID (SoeRequired)
* @return The field value.
*/
[[nodiscard]]
SF_INT32::type::value_type
getBinID() const
{
return this->tx_->at(sfBinID);
}
};
/**
* @brief Builder for AMMBinCreate transactions.
*
* Provides a fluent interface for constructing transactions with method chaining.
* Uses STObject internally for flexible transaction construction.
* Inherits common field setters from TransactionBuilderBase.
*/
class AMMBinCreateBuilder : public TransactionBuilderBase<AMMBinCreateBuilder>
{
public:
/**
* @brief Construct a new AMMBinCreateBuilder with required fields.
* @param account The account initiating the transaction.
* @param asset The sfAsset field value.
* @param asset2 The sfAsset2 field value.
* @param binID The sfBinID field value.
* @param sequence Optional sequence number for the transaction.
* @param fee Optional fee for the transaction.
*/
AMMBinCreateBuilder(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_INT32::type::value_type> const& binID, std::optional<SF_UINT32::type::value_type> sequence = std::nullopt,
std::optional<SF_AMOUNT::type::value_type> fee = std::nullopt
)
: TransactionBuilderBase<AMMBinCreateBuilder>(ttAMM_BIN_CREATE, account, sequence, fee)
{
setAsset(asset);
setAsset2(asset2);
setBinID(binID);
}
/**
* @brief Construct a AMMBinCreateBuilder from an existing STTx object.
* @param tx The existing transaction to copy from.
* @throws std::runtime_error if the transaction type doesn't match.
*/
AMMBinCreateBuilder(std::shared_ptr<STTx const> tx)
{
if (tx->getTxnType() != ttAMM_BIN_CREATE)
{
throw std::runtime_error("Invalid transaction type for AMMBinCreateBuilder");
}
object_ = *tx;
}
/**
* @brief Transaction-specific field setters
*/
/**
* @brief Set sfAsset (SoeRequired)
* @note This field supports MPT (Multi-Purpose Token) amounts.
* @return Reference to this builder for method chaining.
*/
AMMBinCreateBuilder&
setAsset(std::decay_t<typename SF_ISSUE::type::value_type> const& value)
{
object_[sfAsset] = STIssue(sfAsset, value);
return *this;
}
/**
* @brief Set sfAsset2 (SoeRequired)
* @note This field supports MPT (Multi-Purpose Token) amounts.
* @return Reference to this builder for method chaining.
*/
AMMBinCreateBuilder&
setAsset2(std::decay_t<typename SF_ISSUE::type::value_type> const& value)
{
object_[sfAsset2] = STIssue(sfAsset2, value);
return *this;
}
/**
* @brief Set sfBinID (SoeRequired)
* @return Reference to this builder for method chaining.
*/
AMMBinCreateBuilder&
setBinID(std::decay_t<typename SF_INT32::type::value_type> const& value)
{
object_[sfBinID] = value;
return *this;
}
/**
* @brief Build and return the AMMBinCreate wrapper.
* @param publicKey The public key for signing.
* @param secretKey The secret key for signing.
* @return The constructed transaction wrapper.
*/
AMMBinCreate
build(PublicKey const& publicKey, SecretKey const& secretKey)
{
sign(publicKey, secretKey);
return AMMBinCreate{std::make_shared<STTx>(std::move(object_))};
}
};
} // namespace xrpl::transactions

View File

@@ -0,0 +1,183 @@
// 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/TransactionBase.h>
#include <xrpl/protocol_autogen/TransactionBuilderBase.h>
#include <xrpl/json/json_value.h>
#include <stdexcept>
#include <optional>
namespace xrpl::transactions {
class AMMBinDestroyBuilder;
/**
* @brief Transaction: AMMBinDestroy
*
* Type: ttAMM_BIN_DESTROY (111)
* Delegable: Delegation::Delegable
* Amendment: featureAMMCurves
* Privileges: Privilege::DestroyMptIssuance
*
* Immutable wrapper around STTx providing type-safe field access.
* Use AMMBinDestroyBuilder to construct new transactions.
*/
class AMMBinDestroy : public TransactionBase
{
public:
static constexpr xrpl::TxType txType = ttAMM_BIN_DESTROY;
/**
* @brief Construct a AMMBinDestroy transaction wrapper from an existing STTx object.
* @throws std::runtime_error if the transaction type doesn't match.
*/
explicit AMMBinDestroy(std::shared_ptr<STTx const> tx)
: TransactionBase(std::move(tx))
{
// Verify transaction type
if (tx_->getTxnType() != txType)
{
throw std::runtime_error("Invalid transaction type for AMMBinDestroy");
}
}
// Transaction-specific field getters
/**
* @brief Get sfAsset (SoeRequired)
* @note This field supports MPT (Multi-Purpose Token) amounts.
* @return The field value.
*/
[[nodiscard]]
SF_ISSUE::type::value_type
getAsset() const
{
return this->tx_->at(sfAsset);
}
/**
* @brief Get sfAsset2 (SoeRequired)
* @note This field supports MPT (Multi-Purpose Token) amounts.
* @return The field value.
*/
[[nodiscard]]
SF_ISSUE::type::value_type
getAsset2() const
{
return this->tx_->at(sfAsset2);
}
/**
* @brief Get sfBinID (SoeRequired)
* @return The field value.
*/
[[nodiscard]]
SF_INT32::type::value_type
getBinID() const
{
return this->tx_->at(sfBinID);
}
};
/**
* @brief Builder for AMMBinDestroy transactions.
*
* Provides a fluent interface for constructing transactions with method chaining.
* Uses STObject internally for flexible transaction construction.
* Inherits common field setters from TransactionBuilderBase.
*/
class AMMBinDestroyBuilder : public TransactionBuilderBase<AMMBinDestroyBuilder>
{
public:
/**
* @brief Construct a new AMMBinDestroyBuilder with required fields.
* @param account The account initiating the transaction.
* @param asset The sfAsset field value.
* @param asset2 The sfAsset2 field value.
* @param binID The sfBinID field value.
* @param sequence Optional sequence number for the transaction.
* @param fee Optional fee for the transaction.
*/
AMMBinDestroyBuilder(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_INT32::type::value_type> const& binID, std::optional<SF_UINT32::type::value_type> sequence = std::nullopt,
std::optional<SF_AMOUNT::type::value_type> fee = std::nullopt
)
: TransactionBuilderBase<AMMBinDestroyBuilder>(ttAMM_BIN_DESTROY, account, sequence, fee)
{
setAsset(asset);
setAsset2(asset2);
setBinID(binID);
}
/**
* @brief Construct a AMMBinDestroyBuilder from an existing STTx object.
* @param tx The existing transaction to copy from.
* @throws std::runtime_error if the transaction type doesn't match.
*/
AMMBinDestroyBuilder(std::shared_ptr<STTx const> tx)
{
if (tx->getTxnType() != ttAMM_BIN_DESTROY)
{
throw std::runtime_error("Invalid transaction type for AMMBinDestroyBuilder");
}
object_ = *tx;
}
/**
* @brief Transaction-specific field setters
*/
/**
* @brief Set sfAsset (SoeRequired)
* @note This field supports MPT (Multi-Purpose Token) amounts.
* @return Reference to this builder for method chaining.
*/
AMMBinDestroyBuilder&
setAsset(std::decay_t<typename SF_ISSUE::type::value_type> const& value)
{
object_[sfAsset] = STIssue(sfAsset, value);
return *this;
}
/**
* @brief Set sfAsset2 (SoeRequired)
* @note This field supports MPT (Multi-Purpose Token) amounts.
* @return Reference to this builder for method chaining.
*/
AMMBinDestroyBuilder&
setAsset2(std::decay_t<typename SF_ISSUE::type::value_type> const& value)
{
object_[sfAsset2] = STIssue(sfAsset2, value);
return *this;
}
/**
* @brief Set sfBinID (SoeRequired)
* @return Reference to this builder for method chaining.
*/
AMMBinDestroyBuilder&
setBinID(std::decay_t<typename SF_INT32::type::value_type> const& value)
{
object_[sfBinID] = value;
return *this;
}
/**
* @brief Build and return the AMMBinDestroy wrapper.
* @param publicKey The public key for signing.
* @param secretKey The secret key for signing.
* @return The constructed transaction wrapper.
*/
AMMBinDestroy
build(PublicKey const& publicKey, SecretKey const& secretKey)
{
sign(publicKey, secretKey);
return AMMBinDestroy{std::make_shared<STTx>(std::move(object_))};
}
};
} // namespace xrpl::transactions

View File

@@ -108,6 +108,32 @@ public:
{
return this->tx_->isFieldPresent(sfAmount);
}
/**
* @brief Get sfCurveType (SoeOptional)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
protocol_autogen::Optional<SF_UINT8::type::value_type>
getCurveType() const
{
if (hasCurveType())
{
return this->tx_->at(sfCurveType);
}
return std::nullopt;
}
/**
* @brief Check if sfCurveType is present.
* @return True if the field is present, false otherwise.
*/
[[nodiscard]]
bool
hasCurveType() const
{
return this->tx_->isFieldPresent(sfCurveType);
}
};
/**
@@ -205,6 +231,17 @@ public:
return *this;
}
/**
* @brief Set sfCurveType (SoeOptional)
* @return Reference to this builder for method chaining.
*/
AMMClawbackBuilder&
setCurveType(std::decay_t<typename SF_UINT8::type::value_type> const& value)
{
object_[sfCurveType] = value;
return *this;
}
/**
* @brief Build and return the AMMClawback wrapper.
* @param publicKey The public key for signing.

View File

@@ -0,0 +1,270 @@
// 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/TransactionBase.h>
#include <xrpl/protocol_autogen/TransactionBuilderBase.h>
#include <xrpl/json/json_value.h>
#include <stdexcept>
#include <optional>
namespace xrpl::transactions {
class AMMCollectFeesBuilder;
/**
* @brief Transaction: AMMCollectFees
*
* Type: ttAMM_COLLECT_FEES (112)
* Delegable: Delegation::Delegable
* Amendment: featureAMMCurves
* Privileges: Privilege::NoPriv
*
* Immutable wrapper around STTx providing type-safe field access.
* Use AMMCollectFeesBuilder to construct new transactions.
*/
class AMMCollectFees : public TransactionBase
{
public:
static constexpr xrpl::TxType txType = ttAMM_COLLECT_FEES;
/**
* @brief Construct a AMMCollectFees transaction wrapper from an existing STTx object.
* @throws std::runtime_error if the transaction type doesn't match.
*/
explicit AMMCollectFees(std::shared_ptr<STTx const> tx)
: TransactionBase(std::move(tx))
{
// Verify transaction type
if (tx_->getTxnType() != txType)
{
throw std::runtime_error("Invalid transaction type for AMMCollectFees");
}
}
// Transaction-specific field getters
/**
* @brief Get sfAsset (SoeRequired)
* @note This field supports MPT (Multi-Purpose Token) amounts.
* @return The field value.
*/
[[nodiscard]]
SF_ISSUE::type::value_type
getAsset() const
{
return this->tx_->at(sfAsset);
}
/**
* @brief Get sfAsset2 (SoeRequired)
* @note This field supports MPT (Multi-Purpose Token) amounts.
* @return The field value.
*/
[[nodiscard]]
SF_ISSUE::type::value_type
getAsset2() const
{
return this->tx_->at(sfAsset2);
}
/**
* @brief Get sfCurveType (SoeOptional)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
protocol_autogen::Optional<SF_UINT8::type::value_type>
getCurveType() const
{
if (hasCurveType())
{
return this->tx_->at(sfCurveType);
}
return std::nullopt;
}
/**
* @brief Check if sfCurveType is present.
* @return True if the field is present, false otherwise.
*/
[[nodiscard]]
bool
hasCurveType() const
{
return this->tx_->isFieldPresent(sfCurveType);
}
/**
* @brief Get sfPositionID (SoeOptional)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
protocol_autogen::Optional<SF_UINT256::type::value_type>
getPositionID() const
{
if (hasPositionID())
{
return this->tx_->at(sfPositionID);
}
return std::nullopt;
}
/**
* @brief Check if sfPositionID is present.
* @return True if the field is present, false otherwise.
*/
[[nodiscard]]
bool
hasPositionID() const
{
return this->tx_->isFieldPresent(sfPositionID);
}
/**
* @brief Get sfBinID (SoeOptional)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
protocol_autogen::Optional<SF_INT32::type::value_type>
getBinID() const
{
if (hasBinID())
{
return this->tx_->at(sfBinID);
}
return std::nullopt;
}
/**
* @brief Check if sfBinID is present.
* @return True if the field is present, false otherwise.
*/
[[nodiscard]]
bool
hasBinID() const
{
return this->tx_->isFieldPresent(sfBinID);
}
};
/**
* @brief Builder for AMMCollectFees transactions.
*
* Provides a fluent interface for constructing transactions with method chaining.
* Uses STObject internally for flexible transaction construction.
* Inherits common field setters from TransactionBuilderBase.
*/
class AMMCollectFeesBuilder : public TransactionBuilderBase<AMMCollectFeesBuilder>
{
public:
/**
* @brief Construct a new AMMCollectFeesBuilder with required fields.
* @param account The account initiating the transaction.
* @param asset The sfAsset field value.
* @param asset2 The sfAsset2 field value.
* @param sequence Optional sequence number for the transaction.
* @param fee Optional fee for the transaction.
*/
AMMCollectFeesBuilder(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<AMMCollectFeesBuilder>(ttAMM_COLLECT_FEES, account, sequence, fee)
{
setAsset(asset);
setAsset2(asset2);
}
/**
* @brief Construct a AMMCollectFeesBuilder from an existing STTx object.
* @param tx The existing transaction to copy from.
* @throws std::runtime_error if the transaction type doesn't match.
*/
AMMCollectFeesBuilder(std::shared_ptr<STTx const> tx)
{
if (tx->getTxnType() != ttAMM_COLLECT_FEES)
{
throw std::runtime_error("Invalid transaction type for AMMCollectFeesBuilder");
}
object_ = *tx;
}
/**
* @brief Transaction-specific field setters
*/
/**
* @brief Set sfAsset (SoeRequired)
* @note This field supports MPT (Multi-Purpose Token) amounts.
* @return Reference to this builder for method chaining.
*/
AMMCollectFeesBuilder&
setAsset(std::decay_t<typename SF_ISSUE::type::value_type> const& value)
{
object_[sfAsset] = STIssue(sfAsset, value);
return *this;
}
/**
* @brief Set sfAsset2 (SoeRequired)
* @note This field supports MPT (Multi-Purpose Token) amounts.
* @return Reference to this builder for method chaining.
*/
AMMCollectFeesBuilder&
setAsset2(std::decay_t<typename SF_ISSUE::type::value_type> const& value)
{
object_[sfAsset2] = STIssue(sfAsset2, value);
return *this;
}
/**
* @brief Set sfCurveType (SoeOptional)
* @return Reference to this builder for method chaining.
*/
AMMCollectFeesBuilder&
setCurveType(std::decay_t<typename SF_UINT8::type::value_type> const& value)
{
object_[sfCurveType] = value;
return *this;
}
/**
* @brief Set sfPositionID (SoeOptional)
* @return Reference to this builder for method chaining.
*/
AMMCollectFeesBuilder&
setPositionID(std::decay_t<typename SF_UINT256::type::value_type> const& value)
{
object_[sfPositionID] = value;
return *this;
}
/**
* @brief Set sfBinID (SoeOptional)
* @return Reference to this builder for method chaining.
*/
AMMCollectFeesBuilder&
setBinID(std::decay_t<typename SF_INT32::type::value_type> const& value)
{
object_[sfBinID] = value;
return *this;
}
/**
* @brief Build and return the AMMCollectFees wrapper.
* @param publicKey The public key for signing.
* @param secretKey The secret key for signing.
* @return The constructed transaction wrapper.
*/
AMMCollectFees
build(PublicKey const& publicKey, SecretKey const& secretKey)
{
sign(publicKey, secretKey);
return AMMCollectFees{std::make_shared<STTx>(std::move(object_))};
}
};
} // namespace xrpl::transactions

View File

@@ -81,6 +81,110 @@ public:
{
return this->tx_->at(sfTradingFee);
}
/**
* @brief Get sfCurveType (SoeOptional)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
protocol_autogen::Optional<SF_UINT8::type::value_type>
getCurveType() const
{
if (hasCurveType())
{
return this->tx_->at(sfCurveType);
}
return std::nullopt;
}
/**
* @brief Check if sfCurveType is present.
* @return True if the field is present, false otherwise.
*/
[[nodiscard]]
bool
hasCurveType() const
{
return this->tx_->isFieldPresent(sfCurveType);
}
/**
* @brief Get sfFeeTier (SoeOptional)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
protocol_autogen::Optional<SF_UINT8::type::value_type>
getFeeTier() const
{
if (hasFeeTier())
{
return this->tx_->at(sfFeeTier);
}
return std::nullopt;
}
/**
* @brief Check if sfFeeTier is present.
* @return True if the field is present, false otherwise.
*/
[[nodiscard]]
bool
hasFeeTier() const
{
return this->tx_->isFieldPresent(sfFeeTier);
}
/**
* @brief Get sfAmplification (SoeOptional)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
protocol_autogen::Optional<SF_UINT32::type::value_type>
getAmplification() const
{
if (hasAmplification())
{
return this->tx_->at(sfAmplification);
}
return std::nullopt;
}
/**
* @brief Check if sfAmplification is present.
* @return True if the field is present, false otherwise.
*/
[[nodiscard]]
bool
hasAmplification() const
{
return this->tx_->isFieldPresent(sfAmplification);
}
/**
* @brief Get sfBinStep (SoeOptional)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
protocol_autogen::Optional<SF_UINT16::type::value_type>
getBinStep() const
{
if (hasBinStep())
{
return this->tx_->at(sfBinStep);
}
return std::nullopt;
}
/**
* @brief Check if sfBinStep is present.
* @return True if the field is present, false otherwise.
*/
[[nodiscard]]
bool
hasBinStep() const
{
return this->tx_->isFieldPresent(sfBinStep);
}
};
/**
@@ -166,6 +270,50 @@ public:
return *this;
}
/**
* @brief Set sfCurveType (SoeOptional)
* @return Reference to this builder for method chaining.
*/
AMMCreateBuilder&
setCurveType(std::decay_t<typename SF_UINT8::type::value_type> const& value)
{
object_[sfCurveType] = value;
return *this;
}
/**
* @brief Set sfFeeTier (SoeOptional)
* @return Reference to this builder for method chaining.
*/
AMMCreateBuilder&
setFeeTier(std::decay_t<typename SF_UINT8::type::value_type> const& value)
{
object_[sfFeeTier] = value;
return *this;
}
/**
* @brief Set sfAmplification (SoeOptional)
* @return Reference to this builder for method chaining.
*/
AMMCreateBuilder&
setAmplification(std::decay_t<typename SF_UINT32::type::value_type> const& value)
{
object_[sfAmplification] = value;
return *this;
}
/**
* @brief Set sfBinStep (SoeOptional)
* @return Reference to this builder for method chaining.
*/
AMMCreateBuilder&
setBinStep(std::decay_t<typename SF_UINT16::type::value_type> const& value)
{
object_[sfBinStep] = value;
return *this;
}
/**
* @brief Build and return the AMMCreate wrapper.
* @param publicKey The public key for signing.

View File

@@ -70,6 +70,32 @@ public:
{
return this->tx_->at(sfAsset2);
}
/**
* @brief Get sfCurveType (SoeOptional)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
protocol_autogen::Optional<SF_UINT8::type::value_type>
getCurveType() const
{
if (hasCurveType())
{
return this->tx_->at(sfCurveType);
}
return std::nullopt;
}
/**
* @brief Check if sfCurveType is present.
* @return True if the field is present, false otherwise.
*/
[[nodiscard]]
bool
hasCurveType() const
{
return this->tx_->isFieldPresent(sfCurveType);
}
};
/**
@@ -142,6 +168,17 @@ public:
return *this;
}
/**
* @brief Set sfCurveType (SoeOptional)
* @return Reference to this builder for method chaining.
*/
AMMDeleteBuilder&
setCurveType(std::decay_t<typename SF_UINT8::type::value_type> const& value)
{
object_[sfCurveType] = value;
return *this;
}
/**
* @brief Build and return the AMMDelete wrapper.
* @param publicKey The public key for signing.

View File

@@ -202,6 +202,110 @@ public:
{
return this->tx_->isFieldPresent(sfTradingFee);
}
/**
* @brief Get sfCurveType (SoeOptional)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
protocol_autogen::Optional<SF_UINT8::type::value_type>
getCurveType() const
{
if (hasCurveType())
{
return this->tx_->at(sfCurveType);
}
return std::nullopt;
}
/**
* @brief Check if sfCurveType is present.
* @return True if the field is present, false otherwise.
*/
[[nodiscard]]
bool
hasCurveType() const
{
return this->tx_->isFieldPresent(sfCurveType);
}
/**
* @brief Get sfTickLower (SoeOptional)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
protocol_autogen::Optional<SF_INT32::type::value_type>
getTickLower() const
{
if (hasTickLower())
{
return this->tx_->at(sfTickLower);
}
return std::nullopt;
}
/**
* @brief Check if sfTickLower is present.
* @return True if the field is present, false otherwise.
*/
[[nodiscard]]
bool
hasTickLower() const
{
return this->tx_->isFieldPresent(sfTickLower);
}
/**
* @brief Get sfTickUpper (SoeOptional)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
protocol_autogen::Optional<SF_INT32::type::value_type>
getTickUpper() const
{
if (hasTickUpper())
{
return this->tx_->at(sfTickUpper);
}
return std::nullopt;
}
/**
* @brief Check if sfTickUpper is present.
* @return True if the field is present, false otherwise.
*/
[[nodiscard]]
bool
hasTickUpper() const
{
return this->tx_->isFieldPresent(sfTickUpper);
}
/**
* @brief Get sfBinID (SoeOptional)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
protocol_autogen::Optional<SF_INT32::type::value_type>
getBinID() const
{
if (hasBinID())
{
return this->tx_->at(sfBinID);
}
return std::nullopt;
}
/**
* @brief Check if sfBinID is present.
* @return True if the field is present, false otherwise.
*/
[[nodiscard]]
bool
hasBinID() const
{
return this->tx_->isFieldPresent(sfBinID);
}
};
/**
@@ -331,6 +435,50 @@ public:
return *this;
}
/**
* @brief Set sfCurveType (SoeOptional)
* @return Reference to this builder for method chaining.
*/
AMMDepositBuilder&
setCurveType(std::decay_t<typename SF_UINT8::type::value_type> const& value)
{
object_[sfCurveType] = value;
return *this;
}
/**
* @brief Set sfTickLower (SoeOptional)
* @return Reference to this builder for method chaining.
*/
AMMDepositBuilder&
setTickLower(std::decay_t<typename SF_INT32::type::value_type> const& value)
{
object_[sfTickLower] = value;
return *this;
}
/**
* @brief Set sfTickUpper (SoeOptional)
* @return Reference to this builder for method chaining.
*/
AMMDepositBuilder&
setTickUpper(std::decay_t<typename SF_INT32::type::value_type> const& value)
{
object_[sfTickUpper] = value;
return *this;
}
/**
* @brief Set sfBinID (SoeOptional)
* @return Reference to this builder for method chaining.
*/
AMMDepositBuilder&
setBinID(std::decay_t<typename SF_INT32::type::value_type> const& value)
{
object_[sfBinID] = value;
return *this;
}
/**
* @brief Build and return the AMMDeposit wrapper.
* @param publicKey The public key for signing.

View File

@@ -0,0 +1,155 @@
// 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/TransactionBase.h>
#include <xrpl/protocol_autogen/TransactionBuilderBase.h>
#include <xrpl/json/json_value.h>
#include <stdexcept>
#include <optional>
namespace xrpl::transactions {
class AMMPositionTransferBuilder;
/**
* @brief Transaction: AMMPositionTransfer
*
* Type: ttAMM_POSITION_TRANSFER (113)
* Delegable: Delegation::Delegable
* Amendment: featureAMMCurves
* Privileges: Privilege::NoPriv
*
* Immutable wrapper around STTx providing type-safe field access.
* Use AMMPositionTransferBuilder to construct new transactions.
*/
class AMMPositionTransfer : public TransactionBase
{
public:
static constexpr xrpl::TxType txType = ttAMM_POSITION_TRANSFER;
/**
* @brief Construct a AMMPositionTransfer transaction wrapper from an existing STTx object.
* @throws std::runtime_error if the transaction type doesn't match.
*/
explicit AMMPositionTransfer(std::shared_ptr<STTx const> tx)
: TransactionBase(std::move(tx))
{
// Verify transaction type
if (tx_->getTxnType() != txType)
{
throw std::runtime_error("Invalid transaction type for AMMPositionTransfer");
}
}
// Transaction-specific field getters
/**
* @brief Get sfDestination (SoeRequired)
* @return The field value.
*/
[[nodiscard]]
SF_ACCOUNT::type::value_type
getDestination() const
{
return this->tx_->at(sfDestination);
}
/**
* @brief Get sfPositionID (SoeRequired)
* @return The field value.
*/
[[nodiscard]]
SF_UINT256::type::value_type
getPositionID() const
{
return this->tx_->at(sfPositionID);
}
};
/**
* @brief Builder for AMMPositionTransfer transactions.
*
* Provides a fluent interface for constructing transactions with method chaining.
* Uses STObject internally for flexible transaction construction.
* Inherits common field setters from TransactionBuilderBase.
*/
class AMMPositionTransferBuilder : public TransactionBuilderBase<AMMPositionTransferBuilder>
{
public:
/**
* @brief Construct a new AMMPositionTransferBuilder with required fields.
* @param account The account initiating the transaction.
* @param destination The sfDestination field value.
* @param positionID The sfPositionID field value.
* @param sequence Optional sequence number for the transaction.
* @param fee Optional fee for the transaction.
*/
AMMPositionTransferBuilder(SF_ACCOUNT::type::value_type account,
std::decay_t<typename SF_ACCOUNT::type::value_type> const& destination, std::decay_t<typename SF_UINT256::type::value_type> const& positionID, std::optional<SF_UINT32::type::value_type> sequence = std::nullopt,
std::optional<SF_AMOUNT::type::value_type> fee = std::nullopt
)
: TransactionBuilderBase<AMMPositionTransferBuilder>(ttAMM_POSITION_TRANSFER, account, sequence, fee)
{
setDestination(destination);
setPositionID(positionID);
}
/**
* @brief Construct a AMMPositionTransferBuilder from an existing STTx object.
* @param tx The existing transaction to copy from.
* @throws std::runtime_error if the transaction type doesn't match.
*/
AMMPositionTransferBuilder(std::shared_ptr<STTx const> tx)
{
if (tx->getTxnType() != ttAMM_POSITION_TRANSFER)
{
throw std::runtime_error("Invalid transaction type for AMMPositionTransferBuilder");
}
object_ = *tx;
}
/**
* @brief Transaction-specific field setters
*/
/**
* @brief Set sfDestination (SoeRequired)
* @return Reference to this builder for method chaining.
*/
AMMPositionTransferBuilder&
setDestination(std::decay_t<typename SF_ACCOUNT::type::value_type> const& value)
{
object_[sfDestination] = value;
return *this;
}
/**
* @brief Set sfPositionID (SoeRequired)
* @return Reference to this builder for method chaining.
*/
AMMPositionTransferBuilder&
setPositionID(std::decay_t<typename SF_UINT256::type::value_type> const& value)
{
object_[sfPositionID] = value;
return *this;
}
/**
* @brief Build and return the AMMPositionTransfer wrapper.
* @param publicKey The public key for signing.
* @param secretKey The secret key for signing.
* @return The constructed transaction wrapper.
*/
AMMPositionTransfer
build(PublicKey const& publicKey, SecretKey const& secretKey)
{
sign(publicKey, secretKey);
return AMMPositionTransfer{std::make_shared<STTx>(std::move(object_))};
}
};
} // namespace xrpl::transactions

View File

@@ -72,14 +72,81 @@ public:
}
/**
* @brief Get sfTradingFee (SoeRequired)
* @return The field value.
* @brief Get sfTradingFee (SoeOptional)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
SF_UINT16::type::value_type
protocol_autogen::Optional<SF_UINT16::type::value_type>
getTradingFee() const
{
return this->tx_->at(sfTradingFee);
if (hasTradingFee())
{
return this->tx_->at(sfTradingFee);
}
return std::nullopt;
}
/**
* @brief Check if sfTradingFee is present.
* @return True if the field is present, false otherwise.
*/
[[nodiscard]]
bool
hasTradingFee() const
{
return this->tx_->isFieldPresent(sfTradingFee);
}
/**
* @brief Get sfCurveType (SoeOptional)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
protocol_autogen::Optional<SF_UINT8::type::value_type>
getCurveType() const
{
if (hasCurveType())
{
return this->tx_->at(sfCurveType);
}
return std::nullopt;
}
/**
* @brief Check if sfCurveType is present.
* @return True if the field is present, false otherwise.
*/
[[nodiscard]]
bool
hasCurveType() const
{
return this->tx_->isFieldPresent(sfCurveType);
}
/**
* @brief Get sfAmplification (SoeOptional)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
protocol_autogen::Optional<SF_UINT32::type::value_type>
getAmplification() const
{
if (hasAmplification())
{
return this->tx_->at(sfAmplification);
}
return std::nullopt;
}
/**
* @brief Check if sfAmplification is present.
* @return True if the field is present, false otherwise.
*/
[[nodiscard]]
bool
hasAmplification() const
{
return this->tx_->isFieldPresent(sfAmplification);
}
};
@@ -98,19 +165,17 @@ public:
* @param account The account initiating the transaction.
* @param asset The sfAsset field value.
* @param asset2 The sfAsset2 field value.
* @param tradingFee The sfTradingFee field value.
* @param sequence Optional sequence number for the transaction.
* @param fee Optional fee for the transaction.
*/
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::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<AMMVoteBuilder>(ttAMM_VOTE, account, sequence, fee)
{
setAsset(asset);
setAsset2(asset2);
setTradingFee(tradingFee);
}
/**
@@ -156,7 +221,7 @@ public:
}
/**
* @brief Set sfTradingFee (SoeRequired)
* @brief Set sfTradingFee (SoeOptional)
* @return Reference to this builder for method chaining.
*/
AMMVoteBuilder&
@@ -166,6 +231,28 @@ public:
return *this;
}
/**
* @brief Set sfCurveType (SoeOptional)
* @return Reference to this builder for method chaining.
*/
AMMVoteBuilder&
setCurveType(std::decay_t<typename SF_UINT8::type::value_type> const& value)
{
object_[sfCurveType] = value;
return *this;
}
/**
* @brief Set sfAmplification (SoeOptional)
* @return Reference to this builder for method chaining.
*/
AMMVoteBuilder&
setAmplification(std::decay_t<typename SF_UINT32::type::value_type> const& value)
{
object_[sfAmplification] = value;
return *this;
}
/**
* @brief Build and return the AMMVote wrapper.
* @param publicKey The public key for signing.

View File

@@ -176,6 +176,136 @@ public:
{
return this->tx_->isFieldPresent(sfLPTokenIn);
}
/**
* @brief Get sfCurveType (SoeOptional)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
protocol_autogen::Optional<SF_UINT8::type::value_type>
getCurveType() const
{
if (hasCurveType())
{
return this->tx_->at(sfCurveType);
}
return std::nullopt;
}
/**
* @brief Check if sfCurveType is present.
* @return True if the field is present, false otherwise.
*/
[[nodiscard]]
bool
hasCurveType() const
{
return this->tx_->isFieldPresent(sfCurveType);
}
/**
* @brief Get sfPositionID (SoeOptional)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
protocol_autogen::Optional<SF_UINT256::type::value_type>
getPositionID() const
{
if (hasPositionID())
{
return this->tx_->at(sfPositionID);
}
return std::nullopt;
}
/**
* @brief Check if sfPositionID is present.
* @return True if the field is present, false otherwise.
*/
[[nodiscard]]
bool
hasPositionID() const
{
return this->tx_->isFieldPresent(sfPositionID);
}
/**
* @brief Get sfPositionLiquidity (SoeOptional)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
protocol_autogen::Optional<SF_UINT64::type::value_type>
getPositionLiquidity() const
{
if (hasPositionLiquidity())
{
return this->tx_->at(sfPositionLiquidity);
}
return std::nullopt;
}
/**
* @brief Check if sfPositionLiquidity is present.
* @return True if the field is present, false otherwise.
*/
[[nodiscard]]
bool
hasPositionLiquidity() const
{
return this->tx_->isFieldPresent(sfPositionLiquidity);
}
/**
* @brief Get sfBinID (SoeOptional)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
protocol_autogen::Optional<SF_INT32::type::value_type>
getBinID() const
{
if (hasBinID())
{
return this->tx_->at(sfBinID);
}
return std::nullopt;
}
/**
* @brief Check if sfBinID is present.
* @return True if the field is present, false otherwise.
*/
[[nodiscard]]
bool
hasBinID() const
{
return this->tx_->isFieldPresent(sfBinID);
}
/**
* @brief Get sfShares (SoeOptional)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
protocol_autogen::Optional<SF_UINT64::type::value_type>
getShares() const
{
if (hasShares())
{
return this->tx_->at(sfShares);
}
return std::nullopt;
}
/**
* @brief Check if sfShares is present.
* @return True if the field is present, false otherwise.
*/
[[nodiscard]]
bool
hasShares() const
{
return this->tx_->isFieldPresent(sfShares);
}
};
/**
@@ -294,6 +424,61 @@ public:
return *this;
}
/**
* @brief Set sfCurveType (SoeOptional)
* @return Reference to this builder for method chaining.
*/
AMMWithdrawBuilder&
setCurveType(std::decay_t<typename SF_UINT8::type::value_type> const& value)
{
object_[sfCurveType] = value;
return *this;
}
/**
* @brief Set sfPositionID (SoeOptional)
* @return Reference to this builder for method chaining.
*/
AMMWithdrawBuilder&
setPositionID(std::decay_t<typename SF_UINT256::type::value_type> const& value)
{
object_[sfPositionID] = value;
return *this;
}
/**
* @brief Set sfPositionLiquidity (SoeOptional)
* @return Reference to this builder for method chaining.
*/
AMMWithdrawBuilder&
setPositionLiquidity(std::decay_t<typename SF_UINT64::type::value_type> const& value)
{
object_[sfPositionLiquidity] = value;
return *this;
}
/**
* @brief Set sfBinID (SoeOptional)
* @return Reference to this builder for method chaining.
*/
AMMWithdrawBuilder&
setBinID(std::decay_t<typename SF_INT32::type::value_type> const& value)
{
object_[sfBinID] = value;
return *this;
}
/**
* @brief Set sfShares (SoeOptional)
* @return Reference to this builder for method chaining.
*/
AMMWithdrawBuilder&
setShares(std::decay_t<typename SF_UINT64::type::value_type> const& value)
{
object_[sfShares] = value;
return *this;
}
/**
* @brief Build and return the AMMWithdraw wrapper.
* @param publicKey The public key for signing.

Some files were not shown because too many files have changed in this diff Show More