-
Notifications
You must be signed in to change notification settings - Fork 1.7k
refactor: Add initial wrapper classes for all SLEs #7886
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
mvadari
wants to merge
8
commits into
develop
Choose a base branch
from
mvadari/rearch/init
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
f34585d
refactor: Add wrapper classes for all SLEs
mvadari cb90ba0
fix clang-tidy issues
mvadari 1a151c8
fix clang-tidy (hopefully)
mvadari fb809c2
respond to comments
mvadari 9aed87e
add stuff from downstream
mvadari bea1d0d
Merge branch 'develop' into mvadari/rearch/init
mvadari 1c39bec
fix clang-tidy issues
mvadari 755b966
fix clang-tidy weirdness
mvadari File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| #pragma once | ||
|
|
||
| #include <xrpl/basics/base_uint.h> | ||
| #include <xrpl/beast/utility/Journal.h> | ||
| #include <xrpl/ledger/helpers/SLEBase.h> | ||
| #include <xrpl/protocol/Asset.h> | ||
| #include <xrpl/protocol/Indexes.h> | ||
|
|
||
| namespace xrpl { | ||
|
|
||
| template <typename ViewT> | ||
| class AMMEntry : public SLEBase<ViewT> | ||
| { | ||
| public: | ||
| // Inherit base constructors: adopt an existing SLE, or resolve one from a | ||
| // Keylet against the view. | ||
| using SLEBase<ViewT>::SLEBase; | ||
|
|
||
| explicit AMMEntry( | ||
| Asset const& issue1, | ||
| Asset const& issue2, | ||
| SLEBase<ViewT>::view_ref_type view, | ||
| beast::Journal j = beast::Journal{beast::Journal::getNullSink()}) | ||
| : SLEBase<ViewT>(keylet::amm(issue1, issue2), view, j) | ||
| { | ||
| } | ||
|
|
||
| explicit AMMEntry( | ||
| uint256 const& ammID, | ||
| SLEBase<ViewT>::view_ref_type view, | ||
| beast::Journal j = beast::Journal{beast::Journal::getNullSink()}) | ||
| : SLEBase<ViewT>(keylet::amm(ammID), view, j) | ||
| { | ||
| } | ||
| }; | ||
|
|
||
| } // namespace xrpl | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| #pragma once | ||
|
|
||
| #include <xrpl/beast/utility/Journal.h> | ||
| #include <xrpl/ledger/ApplyView.h> | ||
| #include <xrpl/ledger/ReadView.h> | ||
| #include <xrpl/ledger/helpers/SLEBase.h> | ||
| #include <xrpl/protocol/AccountID.h> | ||
| #include <xrpl/protocol/Indexes.h> | ||
|
|
||
| namespace xrpl { | ||
|
|
||
| template <typename ViewT> | ||
| class AccountRootEntry : public SLEBase<ViewT> | ||
| { | ||
| public: | ||
| // Inherit base constructors: adopt an existing SLE, or resolve one from a | ||
| // Keylet against the view. | ||
| using SLEBase<ViewT>::SLEBase; | ||
|
|
||
| explicit AccountRootEntry( | ||
| AccountID const& id, | ||
| SLEBase<ViewT>::view_ref_type view, | ||
|
mvadari marked this conversation as resolved.
|
||
| beast::Journal j = beast::Journal{beast::Journal::getNullSink()}) | ||
| : SLEBase<ViewT>(keylet::account(id), view, j) | ||
| { | ||
| } | ||
| }; | ||
|
|
||
| using RAccountRootEntry = AccountRootEntry<ReadView>; | ||
| using WAccountRootEntry = AccountRootEntry<ApplyView>; | ||
|
|
||
| } // namespace xrpl | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| #pragma once | ||
|
|
||
| #include <xrpl/beast/utility/Journal.h> | ||
| #include <xrpl/ledger/helpers/SLEBase.h> | ||
| #include <xrpl/protocol/Indexes.h> | ||
|
|
||
| namespace xrpl { | ||
|
|
||
| template <typename ViewT> | ||
| class AmendmentsEntry : public SLEBase<ViewT> | ||
| { | ||
| public: | ||
| // Inherit base constructors: adopt an existing SLE, or resolve one from a | ||
| // Keylet against the view. | ||
| using SLEBase<ViewT>::SLEBase; | ||
|
|
||
| explicit AmendmentsEntry( | ||
| SLEBase<ViewT>::view_ref_type view, | ||
|
mvadari marked this conversation as resolved.
|
||
| beast::Journal j = beast::Journal{beast::Journal::getNullSink()}) | ||
| : SLEBase<ViewT>(keylet::amendments(), view, j) | ||
| { | ||
| } | ||
| }; | ||
|
|
||
| } // namespace xrpl | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| #pragma once | ||
|
|
||
| #include <xrpl/beast/utility/Journal.h> | ||
| #include <xrpl/ledger/helpers/SLEBase.h> | ||
| #include <xrpl/protocol/Indexes.h> | ||
| #include <xrpl/protocol/STXChainBridge.h> | ||
|
|
||
| namespace xrpl { | ||
|
|
||
| template <typename ViewT> | ||
| class BridgeEntry : public SLEBase<ViewT> | ||
| { | ||
| public: | ||
| // Inherit base constructors: adopt an existing SLE, or resolve one from a | ||
| // Keylet against the view. | ||
| using SLEBase<ViewT>::SLEBase; | ||
|
|
||
| explicit BridgeEntry( | ||
| STXChainBridge const& bridge, | ||
| STXChainBridge::ChainType chainType, | ||
| SLEBase<ViewT>::view_ref_type view, | ||
|
mvadari marked this conversation as resolved.
|
||
| beast::Journal j = beast::Journal{beast::Journal::getNullSink()}) | ||
| : SLEBase<ViewT>(keylet::bridge(bridge, chainType), view, j) | ||
| { | ||
| } | ||
| }; | ||
|
|
||
| } // namespace xrpl | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| #pragma once | ||
|
|
||
| #include <xrpl/basics/base_uint.h> | ||
| #include <xrpl/beast/utility/Journal.h> | ||
| #include <xrpl/ledger/helpers/SLEBase.h> | ||
| #include <xrpl/protocol/AccountID.h> | ||
| #include <xrpl/protocol/Indexes.h> | ||
|
|
||
| #include <cstdint> | ||
|
|
||
| namespace xrpl { | ||
|
|
||
| template <typename ViewT> | ||
| class CheckEntry : public SLEBase<ViewT> | ||
| { | ||
| public: | ||
| // Inherit base constructors: adopt an existing SLE, or resolve one from a | ||
| // Keylet against the view. | ||
| using SLEBase<ViewT>::SLEBase; | ||
|
|
||
| explicit CheckEntry( | ||
| AccountID const& id, | ||
| std::uint32_t seq, | ||
| SLEBase<ViewT>::view_ref_type view, | ||
|
mvadari marked this conversation as resolved.
|
||
| beast::Journal j = beast::Journal{beast::Journal::getNullSink()}) | ||
| : SLEBase<ViewT>(keylet::check(id, seq), view, j) | ||
| { | ||
| } | ||
|
|
||
| explicit CheckEntry( | ||
| uint256 const& checkID, | ||
| SLEBase<ViewT>::view_ref_type view, | ||
| beast::Journal j = beast::Journal{beast::Journal::getNullSink()}) | ||
| : SLEBase<ViewT>(keylet::check(checkID), view, j) | ||
| { | ||
| } | ||
| }; | ||
|
|
||
| } // namespace xrpl | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| #pragma once | ||
|
|
||
| #include <xrpl/basics/Slice.h> | ||
| #include <xrpl/basics/base_uint.h> | ||
| #include <xrpl/beast/utility/Journal.h> | ||
| #include <xrpl/ledger/helpers/SLEBase.h> | ||
| #include <xrpl/protocol/AccountID.h> | ||
| #include <xrpl/protocol/Indexes.h> | ||
|
|
||
| namespace xrpl { | ||
|
|
||
| template <typename ViewT> | ||
| class CredentialEntry : public SLEBase<ViewT> | ||
| { | ||
| public: | ||
| // Inherit base constructors: adopt an existing SLE, or resolve one from a | ||
| // Keylet against the view. | ||
| using SLEBase<ViewT>::SLEBase; | ||
|
|
||
| explicit CredentialEntry( | ||
| AccountID const& subject, | ||
| AccountID const& issuer, | ||
| Slice const& credType, | ||
| SLEBase<ViewT>::view_ref_type view, | ||
|
mvadari marked this conversation as resolved.
|
||
| beast::Journal j = beast::Journal{beast::Journal::getNullSink()}) | ||
| : SLEBase<ViewT>(keylet::credential(subject, issuer, credType), view, j) | ||
| { | ||
| } | ||
|
|
||
| explicit CredentialEntry( | ||
| uint256 const& credentialID, | ||
| SLEBase<ViewT>::view_ref_type view, | ||
| beast::Journal j = beast::Journal{beast::Journal::getNullSink()}) | ||
| : SLEBase<ViewT>(keylet::credential(credentialID), view, j) | ||
| { | ||
| } | ||
| }; | ||
|
|
||
| } // namespace xrpl | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| #pragma once | ||
|
|
||
| #include <xrpl/beast/utility/Journal.h> | ||
| #include <xrpl/ledger/helpers/SLEBase.h> | ||
| #include <xrpl/protocol/AccountID.h> | ||
| #include <xrpl/protocol/Indexes.h> | ||
|
|
||
| namespace xrpl { | ||
|
|
||
| template <typename ViewT> | ||
| class DIDEntry : public SLEBase<ViewT> | ||
| { | ||
| public: | ||
| // Inherit base constructors: adopt an existing SLE, or resolve one from a | ||
| // Keylet against the view. | ||
| using SLEBase<ViewT>::SLEBase; | ||
|
|
||
| explicit DIDEntry( | ||
| AccountID const& account, | ||
| SLEBase<ViewT>::view_ref_type view, | ||
|
mvadari marked this conversation as resolved.
|
||
| beast::Journal j = beast::Journal{beast::Journal::getNullSink()}) | ||
| : SLEBase<ViewT>(keylet::did(account), view, j) | ||
| { | ||
| } | ||
| }; | ||
|
|
||
| } // namespace xrpl | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| #pragma once | ||
|
|
||
| #include <xrpl/beast/utility/Journal.h> | ||
| #include <xrpl/ledger/helpers/SLEBase.h> | ||
| #include <xrpl/protocol/AccountID.h> | ||
| #include <xrpl/protocol/Indexes.h> | ||
|
|
||
| namespace xrpl { | ||
|
|
||
| template <typename ViewT> | ||
| class DelegateEntry : public SLEBase<ViewT> | ||
| { | ||
| public: | ||
| // Inherit base constructors: adopt an existing SLE, or resolve one from a | ||
| // Keylet against the view. | ||
| using SLEBase<ViewT>::SLEBase; | ||
|
|
||
| explicit DelegateEntry( | ||
| AccountID const& account, | ||
| AccountID const& authorizedAccount, | ||
| SLEBase<ViewT>::view_ref_type view, | ||
|
mvadari marked this conversation as resolved.
|
||
| beast::Journal j = beast::Journal{beast::Journal::getNullSink()}) | ||
| : SLEBase<ViewT>(keylet::delegate(account, authorizedAccount), view, j) | ||
| { | ||
| } | ||
| }; | ||
|
|
||
| } // namespace xrpl | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| #pragma once | ||
|
|
||
| #include <xrpl/basics/Slice.h> | ||
| #include <xrpl/basics/base_uint.h> | ||
| #include <xrpl/beast/utility/Journal.h> | ||
| #include <xrpl/ledger/helpers/SLEBase.h> | ||
| #include <xrpl/protocol/AccountID.h> | ||
| #include <xrpl/protocol/Indexes.h> | ||
|
|
||
| #include <set> | ||
| #include <utility> | ||
|
|
||
| namespace xrpl { | ||
|
|
||
| template <typename ViewT> | ||
| class DepositPreauthEntry : public SLEBase<ViewT> | ||
| { | ||
| public: | ||
| // Inherit base constructors: adopt an existing SLE, or resolve one from a | ||
| // Keylet against the view. | ||
| using SLEBase<ViewT>::SLEBase; | ||
|
|
||
| explicit DepositPreauthEntry( | ||
| AccountID const& owner, | ||
| AccountID const& preauthorized, | ||
| SLEBase<ViewT>::view_ref_type view, | ||
|
mvadari marked this conversation as resolved.
|
||
| beast::Journal j = beast::Journal{beast::Journal::getNullSink()}) | ||
| : SLEBase<ViewT>(keylet::depositPreauth(owner, preauthorized), view, j) | ||
| { | ||
| } | ||
|
|
||
| explicit DepositPreauthEntry( | ||
| AccountID const& owner, | ||
| std::set<std::pair<AccountID, Slice>> const& authCreds, | ||
| SLEBase<ViewT>::view_ref_type view, | ||
| beast::Journal j = beast::Journal{beast::Journal::getNullSink()}) | ||
| : SLEBase<ViewT>(keylet::depositPreauth(owner, authCreds), view, j) | ||
| { | ||
| } | ||
|
|
||
| explicit DepositPreauthEntry( | ||
| uint256 const& preauthID, | ||
| SLEBase<ViewT>::view_ref_type view, | ||
| beast::Journal j = beast::Journal{beast::Journal::getNullSink()}) | ||
| : SLEBase<ViewT>(keylet::depositPreauth(preauthID), view, j) | ||
| { | ||
| } | ||
| }; | ||
|
|
||
| } // namespace xrpl | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| #pragma once | ||
|
|
||
| #include <xrpl/basics/base_uint.h> | ||
| #include <xrpl/beast/utility/Journal.h> | ||
| #include <xrpl/ledger/helpers/SLEBase.h> | ||
| #include <xrpl/protocol/AccountID.h> | ||
| #include <xrpl/protocol/Indexes.h> | ||
|
|
||
| #include <cstdint> | ||
|
|
||
| namespace xrpl { | ||
|
|
||
| template <typename ViewT> | ||
| class DirectoryNodeEntry : public SLEBase<ViewT> | ||
| { | ||
| public: | ||
| // Inherit base constructors: adopt an existing SLE, or resolve one from a | ||
| // Keylet against the view. | ||
| using SLEBase<ViewT>::SLEBase; | ||
|
|
||
| explicit DirectoryNodeEntry( | ||
| AccountID const& id, | ||
| SLEBase<ViewT>::view_ref_type view, | ||
|
mvadari marked this conversation as resolved.
|
||
| beast::Journal j = beast::Journal{beast::Journal::getNullSink()}) | ||
| : SLEBase<ViewT>(keylet::ownerDir(id), view, j) | ||
| { | ||
| } | ||
|
|
||
| /** | ||
| * Resolve a specific page of the directory rooted at @p root. | ||
| */ | ||
| explicit DirectoryNodeEntry( | ||
| uint256 const& root, | ||
| std::uint64_t index, | ||
| SLEBase<ViewT>::view_ref_type view, | ||
| beast::Journal j = beast::Journal{beast::Journal::getNullSink()}) | ||
| : SLEBase<ViewT>(keylet::page(root, index), view, j) | ||
| { | ||
| } | ||
| }; | ||
|
|
||
| } // namespace xrpl | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| #pragma once | ||
|
|
||
| #include <xrpl/beast/utility/Journal.h> | ||
| #include <xrpl/ledger/helpers/SLEBase.h> | ||
| #include <xrpl/protocol/AccountID.h> | ||
| #include <xrpl/protocol/Indexes.h> | ||
|
|
||
| #include <cstdint> | ||
|
|
||
| namespace xrpl { | ||
|
|
||
| template <typename ViewT> | ||
| class EscrowEntry : public SLEBase<ViewT> | ||
| { | ||
| public: | ||
| // Inherit base constructors: adopt an existing SLE, or resolve one from a | ||
| // Keylet against the view. | ||
| using SLEBase<ViewT>::SLEBase; | ||
|
|
||
| explicit EscrowEntry( | ||
| AccountID const& src, | ||
| std::uint32_t seq, | ||
| SLEBase<ViewT>::view_ref_type view, | ||
|
mvadari marked this conversation as resolved.
|
||
| beast::Journal j = beast::Journal{beast::Journal::getNullSink()}) | ||
| : SLEBase<ViewT>(keylet::escrow(src, seq), view, j) | ||
| { | ||
| } | ||
| }; | ||
|
|
||
| } // namespace xrpl | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.