mirror of
https://github.com/XRPLF/rippled.git
synced 2026-09-27 07:26:51 +00:00
featureFirewall
This commit is contained in:
17
include/xrpl/protocol/Firewall.h
Normal file
17
include/xrpl/protocol/Firewall.h
Normal 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
|
||||
@@ -366,6 +366,33 @@ vault(uint256 const& vaultKey)
|
||||
Keylet
|
||||
loanBroker(AccountID const& owner, SeqProxy const& seq) noexcept;
|
||||
|
||||
/**
|
||||
* 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)
|
||||
{
|
||||
|
||||
@@ -184,6 +184,7 @@ enum TEFcodes : TERUnderlyingType {
|
||||
tefBAD_PATH_COUNT,
|
||||
tefNO_BYTECODE,
|
||||
tefBYTECODE_NOT_INCLUDED,
|
||||
tefFIREWALL_BLOCK,
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
@@ -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.
|
||||
*
|
||||
@@ -91,6 +112,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
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
// Add new amendments to the top of this list.
|
||||
// Keep it sorted in reverse chronological order.
|
||||
|
||||
XRPL_FEATURE(Firewall, Supported::No, VoteBehavior::DefaultNo)
|
||||
XRPL_FEATURE(SmartEscrow, Supported::No, VoteBehavior::DefaultNo)
|
||||
XRPL_FEATURE(LendingProtocolV1_2, Supported::No, VoteBehavior::DefaultNo)
|
||||
XRPL_FIX (Cleanup3_5_0, Supported::Yes, VoteBehavior::DefaultNo)
|
||||
|
||||
@@ -522,6 +522,31 @@ LEDGER_ENTRY(ltVAULT, 0x0084, Vault, vault, ({
|
||||
// no PermissionedDomainID ever (use MPTIssuance.sfDomainID)
|
||||
}))
|
||||
|
||||
/** 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},
|
||||
}))
|
||||
|
||||
/** Reserve 0x0084-0x0087 for future Vault-related objects. */
|
||||
|
||||
/** A ledger object representing a loan broker
|
||||
|
||||
@@ -220,6 +220,7 @@ TYPED_SFIELD(sfLoanID, UINT256, 38)
|
||||
TYPED_SFIELD(sfReferenceHolding, UINT256, 39)
|
||||
TYPED_SFIELD(sfBlindingFactor, UINT256, 40)
|
||||
TYPED_SFIELD(sfObjectID, UINT256, 41)
|
||||
TYPED_SFIELD(sfFirewallID, UINT256, 42)
|
||||
|
||||
// number (common)
|
||||
TYPED_SFIELD(sfNumber, NUMBER, 1)
|
||||
@@ -360,6 +361,7 @@ TYPED_SFIELD(sfHighSponsor, ACCOUNT, 28)
|
||||
TYPED_SFIELD(sfLowSponsor, ACCOUNT, 29)
|
||||
TYPED_SFIELD(sfCounterpartySponsor, ACCOUNT, 30)
|
||||
TYPED_SFIELD(sfSponsee, ACCOUNT, 31)
|
||||
TYPED_SFIELD(sfBackup, ACCOUNT, 32)
|
||||
|
||||
// vector of 256-bit
|
||||
TYPED_SFIELD(sfIndexes, VECTOR256, 1, SField::kSmdNever)
|
||||
|
||||
@@ -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,7 +64,7 @@ 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},
|
||||
@@ -79,7 +79,7 @@ TRANSACTION(ttESCROW_CREATE, 1, EscrowCreate, ({.delegable = Delegation::Delegab
|
||||
#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},
|
||||
@@ -112,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},
|
||||
}))
|
||||
@@ -134,7 +134,7 @@ 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},
|
||||
@@ -180,7 +180,7 @@ 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},
|
||||
{sfSettleDelay, SoeRequired},
|
||||
@@ -193,7 +193,7 @@ 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},
|
||||
{sfExpiration, SoeOptional},
|
||||
@@ -216,7 +216,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},
|
||||
@@ -286,7 +286,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},
|
||||
@@ -312,7 +312,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},
|
||||
@@ -370,11 +370,9 @@ TRANSACTION(ttAMM_CLAWBACK, 31, AMMClawback,
|
||||
# include <xrpl/tx/transactors/dex/AMMCreate.h>
|
||||
#endif
|
||||
TRANSACTION(ttAMM_CREATE, 35, AMMCreate,
|
||||
({
|
||||
.delegable = Delegation::Delegable,
|
||||
({.delegable = Delegation::Delegable,
|
||||
.amendment = featureAMM,
|
||||
.privileges = Privilege::CreatePseudoAcct | Privilege::MayCreateMpt,
|
||||
}),
|
||||
.privileges = Privilege::CreatePseudoAcct | Privilege::MayCreateMpt, .firewall = FirewallAction::Block}),
|
||||
({
|
||||
{sfAmount, SoeRequired, SoeMptSupported},
|
||||
{sfAmount2, SoeRequired, SoeMptSupported},
|
||||
@@ -386,7 +384,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},
|
||||
@@ -402,11 +400,9 @@ TRANSACTION(ttAMM_DEPOSIT, 36, AMMDeposit,
|
||||
# include <xrpl/tx/transactors/dex/AMMWithdraw.h>
|
||||
#endif
|
||||
TRANSACTION(ttAMM_WITHDRAW, 37, AMMWithdraw,
|
||||
({
|
||||
.delegable = Delegation::Delegable,
|
||||
({.delegable = Delegation::Delegable,
|
||||
.amendment = featureAMM,
|
||||
.privileges = Privilege::MayDeleteAcct | Privilege::MayAuthorizeMpt,
|
||||
}),
|
||||
.privileges = Privilege::MayDeleteAcct | Privilege::MayAuthorizeMpt, .firewall = FirewallAction::Block}),
|
||||
({
|
||||
{sfAsset, SoeRequired, SoeMptSupported},
|
||||
{sfAsset2, SoeRequired, SoeMptSupported},
|
||||
@@ -421,7 +417,7 @@ 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},
|
||||
@@ -433,7 +429,7 @@ 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},
|
||||
@@ -447,11 +443,9 @@ TRANSACTION(ttAMM_BID, 39, AMMBid,
|
||||
# include <xrpl/tx/transactors/dex/AMMDelete.h>
|
||||
#endif
|
||||
TRANSACTION(ttAMM_DELETE, 40, AMMDelete,
|
||||
({
|
||||
.delegable = Delegation::Delegable,
|
||||
({.delegable = Delegation::Delegable,
|
||||
.amendment = featureAMM,
|
||||
.privileges = Privilege::MustDeleteAcct | Privilege::MayDeleteMpt,
|
||||
}),
|
||||
.privileges = Privilege::MustDeleteAcct | Privilege::MayDeleteMpt, .firewall = FirewallAction::Block}),
|
||||
({
|
||||
{sfAsset, SoeRequired, SoeMptSupported},
|
||||
{sfAsset2, SoeRequired, SoeMptSupported},
|
||||
@@ -462,7 +456,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},
|
||||
@@ -471,7 +465,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},
|
||||
@@ -481,7 +475,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},
|
||||
@@ -492,7 +486,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},
|
||||
@@ -502,11 +496,9 @@ TRANSACTION(ttXCHAIN_ACCOUNT_CREATE_COMMIT, 44, XChainAccountCreateCommit,
|
||||
|
||||
/** This transaction adds an attestation to a claim */
|
||||
TRANSACTION(ttXCHAIN_ADD_CLAIM_ATTESTATION, 45, XChainAddClaimAttestation,
|
||||
({
|
||||
.delegable = Delegation::Delegable,
|
||||
({.delegable = Delegation::Delegable,
|
||||
.amendment = featureXChainBridge,
|
||||
.privileges = Privilege::CreateAcct,
|
||||
}),
|
||||
.privileges = Privilege::CreateAcct, .firewall = FirewallAction::Block}),
|
||||
({
|
||||
{sfXChainBridge, SoeRequired},
|
||||
|
||||
@@ -524,11 +516,9 @@ TRANSACTION(ttXCHAIN_ADD_CLAIM_ATTESTATION, 45, XChainAddClaimAttestation,
|
||||
|
||||
/** This transaction adds an attestation to an account */
|
||||
TRANSACTION(ttXCHAIN_ADD_ACCOUNT_CREATE_ATTESTATION, 46, XChainAddAccountCreateAttestation,
|
||||
({
|
||||
.delegable = Delegation::Delegable,
|
||||
({.delegable = Delegation::Delegable,
|
||||
.amendment = featureXChainBridge,
|
||||
.privileges = Privilege::CreateAcct,
|
||||
}),
|
||||
.privileges = Privilege::CreateAcct, .firewall = FirewallAction::Block}),
|
||||
({
|
||||
{sfXChainBridge, SoeRequired},
|
||||
|
||||
@@ -547,7 +537,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},
|
||||
@@ -556,7 +546,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},
|
||||
@@ -772,11 +762,9 @@ TRANSACTION(ttDELEGATE_SET, 64, DelegateSet,
|
||||
# include <xrpl/tx/transactors/vault/VaultCreate.h>
|
||||
#endif
|
||||
TRANSACTION(ttVAULT_CREATE, 65, VaultCreate,
|
||||
({
|
||||
.amendment = featureSingleAssetVault,
|
||||
({.amendment = featureSingleAssetVault,
|
||||
.privileges = Privilege::CreatePseudoAcct | Privilege::CreateMptIssuance |
|
||||
Privilege::MustModifyVault,
|
||||
}),
|
||||
Privilege::MustModifyVault, .firewall = FirewallAction::Block}),
|
||||
({
|
||||
{sfAsset, SoeRequired, SoeMptSupported},
|
||||
{sfAssetsMaximum, SoeOptional},
|
||||
@@ -795,10 +783,8 @@ TRANSACTION(ttVAULT_CREATE, 65, VaultCreate,
|
||||
# include <xrpl/tx/transactors/vault/VaultSet.h>
|
||||
#endif
|
||||
TRANSACTION(ttVAULT_SET, 66, VaultSet,
|
||||
({
|
||||
.amendment = featureSingleAssetVault,
|
||||
.privileges = Privilege::MustModifyVault,
|
||||
}),
|
||||
({.amendment = featureSingleAssetVault,
|
||||
.privileges = Privilege::MustModifyVault, .firewall = FirewallAction::Block}),
|
||||
({
|
||||
{sfVaultID, SoeRequired},
|
||||
{sfAssetsMaximum, SoeOptional},
|
||||
@@ -811,11 +797,9 @@ TRANSACTION(ttVAULT_SET, 66, VaultSet,
|
||||
# include <xrpl/tx/transactors/vault/VaultDelete.h>
|
||||
#endif
|
||||
TRANSACTION(ttVAULT_DELETE, 67, VaultDelete,
|
||||
({
|
||||
.amendment = featureSingleAssetVault,
|
||||
({.amendment = featureSingleAssetVault,
|
||||
.privileges = Privilege::MustDeleteAcct | Privilege::DestroyMptIssuance |
|
||||
Privilege::MustModifyVault,
|
||||
}),
|
||||
Privilege::MustModifyVault, .firewall = FirewallAction::Block}),
|
||||
({
|
||||
{sfVaultID, SoeRequired},
|
||||
{sfMemoData, SoeOptional},
|
||||
@@ -826,10 +810,8 @@ TRANSACTION(ttVAULT_DELETE, 67, VaultDelete,
|
||||
# include <xrpl/tx/transactors/vault/VaultDeposit.h>
|
||||
#endif
|
||||
TRANSACTION(ttVAULT_DEPOSIT, 68, VaultDeposit,
|
||||
({
|
||||
.amendment = featureSingleAssetVault,
|
||||
.privileges = Privilege::MayAuthorizeMpt | Privilege::MustModifyVault,
|
||||
}),
|
||||
({.amendment = featureSingleAssetVault,
|
||||
.privileges = Privilege::MayAuthorizeMpt | Privilege::MustModifyVault, .firewall = FirewallAction::Block}),
|
||||
({
|
||||
{sfVaultID, SoeRequired},
|
||||
{sfAmount, SoeRequired, SoeMptSupported},
|
||||
@@ -840,11 +822,9 @@ TRANSACTION(ttVAULT_DEPOSIT, 68, VaultDeposit,
|
||||
# include <xrpl/tx/transactors/vault/VaultWithdraw.h>
|
||||
#endif
|
||||
TRANSACTION(ttVAULT_WITHDRAW, 69, VaultWithdraw,
|
||||
({
|
||||
.amendment = featureSingleAssetVault,
|
||||
({.amendment = featureSingleAssetVault,
|
||||
.privileges = Privilege::MayDeleteMpt | Privilege::MayAuthorizeMpt |
|
||||
Privilege::MustModifyVault,
|
||||
}),
|
||||
Privilege::MustModifyVault, .firewall = FirewallAction::Block}),
|
||||
({
|
||||
{sfVaultID, SoeRequired},
|
||||
{sfAmount, SoeRequired, SoeMptSupported},
|
||||
@@ -858,10 +838,8 @@ TRANSACTION(ttVAULT_WITHDRAW, 69, VaultWithdraw,
|
||||
# include <xrpl/tx/transactors/vault/VaultClawback.h>
|
||||
#endif
|
||||
TRANSACTION(ttVAULT_CLAWBACK, 70, VaultClawback,
|
||||
({
|
||||
.amendment = featureSingleAssetVault,
|
||||
.privileges = Privilege::MayDeleteMpt | Privilege::MustModifyVault,
|
||||
}),
|
||||
({.amendment = featureSingleAssetVault,
|
||||
.privileges = Privilege::MayDeleteMpt | Privilege::MustModifyVault, .firewall = FirewallAction::Block}),
|
||||
({
|
||||
{sfVaultID, SoeRequired},
|
||||
{sfHolder, SoeRequired},
|
||||
@@ -888,10 +866,8 @@ TRANSACTION(ttBATCH, 71, Batch,
|
||||
# include <xrpl/tx/transactors/lending/LoanBrokerSet.h>
|
||||
#endif
|
||||
TRANSACTION(ttLOAN_BROKER_SET, 74, LoanBrokerSet,
|
||||
({
|
||||
.amendment = featureLendingProtocol,
|
||||
.privileges = Privilege::CreatePseudoAcct | Privilege::MayAuthorizeMpt,
|
||||
}),
|
||||
({.amendment = featureLendingProtocol,
|
||||
.privileges = Privilege::CreatePseudoAcct | Privilege::MayAuthorizeMpt, .firewall = FirewallAction::Block}),
|
||||
({
|
||||
{sfVaultID, SoeRequired},
|
||||
{sfLoanBrokerID, SoeOptional},
|
||||
@@ -907,10 +883,8 @@ TRANSACTION(ttLOAN_BROKER_SET, 74, LoanBrokerSet,
|
||||
# include <xrpl/tx/transactors/lending/LoanBrokerDelete.h>
|
||||
#endif
|
||||
TRANSACTION(ttLOAN_BROKER_DELETE, 75, LoanBrokerDelete,
|
||||
({
|
||||
.amendment = featureLendingProtocol,
|
||||
.privileges = Privilege::MustDeleteAcct | Privilege::MayAuthorizeMpt,
|
||||
}),
|
||||
({.amendment = featureLendingProtocol,
|
||||
.privileges = Privilege::MustDeleteAcct | Privilege::MayAuthorizeMpt, .firewall = FirewallAction::Block}),
|
||||
({
|
||||
{sfLoanBrokerID, SoeRequired},
|
||||
}))
|
||||
@@ -920,9 +894,7 @@ TRANSACTION(ttLOAN_BROKER_DELETE, 75, LoanBrokerDelete,
|
||||
# include <xrpl/tx/transactors/lending/LoanBrokerCoverDeposit.h>
|
||||
#endif
|
||||
TRANSACTION(ttLOAN_BROKER_COVER_DEPOSIT, 76, LoanBrokerCoverDeposit,
|
||||
({
|
||||
.amendment = featureLendingProtocol,
|
||||
}),
|
||||
({.amendment = featureLendingProtocol, .firewall = FirewallAction::Block}),
|
||||
({
|
||||
{sfLoanBrokerID, SoeRequired},
|
||||
{sfAmount, SoeRequired, SoeMptSupported},
|
||||
@@ -933,10 +905,8 @@ TRANSACTION(ttLOAN_BROKER_COVER_DEPOSIT, 76, LoanBrokerCoverDeposit,
|
||||
# include <xrpl/tx/transactors/lending/LoanBrokerCoverWithdraw.h>
|
||||
#endif
|
||||
TRANSACTION(ttLOAN_BROKER_COVER_WITHDRAW, 77, LoanBrokerCoverWithdraw,
|
||||
({
|
||||
.amendment = featureLendingProtocol,
|
||||
.privileges = Privilege::MayAuthorizeMpt,
|
||||
}),
|
||||
({.amendment = featureLendingProtocol,
|
||||
.privileges = Privilege::MayAuthorizeMpt, .firewall = FirewallAction::Block}),
|
||||
({
|
||||
{sfLoanBrokerID, SoeRequired},
|
||||
{sfAmount, SoeRequired, SoeMptSupported},
|
||||
@@ -951,9 +921,7 @@ TRANSACTION(ttLOAN_BROKER_COVER_WITHDRAW, 77, LoanBrokerCoverWithdraw,
|
||||
# include <xrpl/tx/transactors/lending/LoanBrokerCoverClawback.h>
|
||||
#endif
|
||||
TRANSACTION(ttLOAN_BROKER_COVER_CLAWBACK, 78, LoanBrokerCoverClawback,
|
||||
({
|
||||
.amendment = featureLendingProtocol,
|
||||
}),
|
||||
({.amendment = featureLendingProtocol, .firewall = FirewallAction::Block}),
|
||||
({
|
||||
{sfLoanBrokerID, SoeOptional},
|
||||
{sfAmount, SoeOptional, SoeMptSupported},
|
||||
@@ -964,10 +932,8 @@ TRANSACTION(ttLOAN_BROKER_COVER_CLAWBACK, 78, LoanBrokerCoverClawback,
|
||||
# include <xrpl/tx/transactors/lending/LoanSet.h>
|
||||
#endif
|
||||
TRANSACTION(ttLOAN_SET, 80, LoanSet,
|
||||
({
|
||||
.amendment = featureLendingProtocol,
|
||||
.privileges = Privilege::MayAuthorizeMpt | Privilege::MustModifyVault,
|
||||
}),
|
||||
({.amendment = featureLendingProtocol,
|
||||
.privileges = Privilege::MayAuthorizeMpt | Privilege::MustModifyVault, .firewall = FirewallAction::Block}),
|
||||
({
|
||||
{sfLoanBrokerID, SoeRequired},
|
||||
{sfData, SoeOptional},
|
||||
@@ -993,9 +959,7 @@ TRANSACTION(ttLOAN_SET, 80, LoanSet,
|
||||
# include <xrpl/tx/transactors/lending/LoanDelete.h>
|
||||
#endif
|
||||
TRANSACTION(ttLOAN_DELETE, 81, LoanDelete,
|
||||
({
|
||||
.amendment = featureLendingProtocol,
|
||||
}),
|
||||
({.amendment = featureLendingProtocol, .firewall = FirewallAction::Block}),
|
||||
({
|
||||
{sfLoanID, SoeRequired},
|
||||
}))
|
||||
@@ -1005,13 +969,11 @@ TRANSACTION(ttLOAN_DELETE, 81, LoanDelete,
|
||||
# include <xrpl/tx/transactors/lending/LoanManage.h>
|
||||
#endif
|
||||
TRANSACTION(ttLOAN_MANAGE, 82, LoanManage,
|
||||
({
|
||||
.amendment = featureLendingProtocol,
|
||||
({.amendment = featureLendingProtocol,
|
||||
// All of the LoanManage options will modify the vault, but the
|
||||
// transaction can succeed without options, essentially making it
|
||||
// a noop.
|
||||
.privileges = Privilege::MayModifyVault,
|
||||
}),
|
||||
.privileges = Privilege::MayModifyVault, .firewall = FirewallAction::Block}),
|
||||
({
|
||||
{sfLoanID, SoeRequired},
|
||||
}))
|
||||
@@ -1021,10 +983,8 @@ TRANSACTION(ttLOAN_MANAGE, 82, LoanManage,
|
||||
# include <xrpl/tx/transactors/lending/LoanPay.h>
|
||||
#endif
|
||||
TRANSACTION(ttLOAN_PAY, 84, LoanPay,
|
||||
({
|
||||
.amendment = featureLendingProtocol,
|
||||
.privileges = Privilege::MayAuthorizeMpt | Privilege::MustModifyVault,
|
||||
}),
|
||||
({.amendment = featureLendingProtocol,
|
||||
.privileges = Privilege::MayAuthorizeMpt | Privilege::MustModifyVault, .firewall = FirewallAction::Block}),
|
||||
({
|
||||
{sfLoanID, SoeRequired},
|
||||
{sfAmount, SoeRequired, SoeMptSupported},
|
||||
@@ -1035,9 +995,7 @@ TRANSACTION(ttLOAN_PAY, 84, LoanPay,
|
||||
# include <xrpl/tx/transactors/token/ConfidentialMPTConvert.h>
|
||||
#endif
|
||||
TRANSACTION(ttCONFIDENTIAL_MPT_CONVERT, 85, ConfidentialMPTConvert,
|
||||
({
|
||||
.amendment = featureConfidentialTransfer,
|
||||
}),
|
||||
({.amendment = featureConfidentialTransfer, .firewall = FirewallAction::Block}),
|
||||
({
|
||||
{sfMPTokenIssuanceID, SoeRequired},
|
||||
{sfMPTAmount, SoeRequired},
|
||||
@@ -1054,7 +1012,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},
|
||||
}))
|
||||
@@ -1064,7 +1022,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},
|
||||
@@ -1080,7 +1038,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},
|
||||
@@ -1112,9 +1070,7 @@ TRANSACTION(ttCONFIDENTIAL_MPT_CLAWBACK, 89, ConfidentialMPTClawback,
|
||||
# include <xrpl/tx/transactors/sponsor/SponsorshipTransfer.h>
|
||||
#endif
|
||||
TRANSACTION(ttSPONSORSHIP_TRANSFER, 90, SponsorshipTransfer,
|
||||
({
|
||||
.amendment = featureSponsor,
|
||||
}),
|
||||
({.amendment = featureSponsor, .firewall = FirewallAction::Check}),
|
||||
({
|
||||
{sfObjectID, SoeOptional},
|
||||
{sfSponsee, SoeOptional},
|
||||
@@ -1181,3 +1137,43 @@ TRANSACTION(ttUNL_MODIFY, 102, UNLModify,
|
||||
{sfLedgerSequence, SoeRequired},
|
||||
{sfUNLModifyValidator, 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},
|
||||
}))
|
||||
|
||||
252
include/xrpl/protocol_autogen/ledger_entries/Firewall.h
Normal file
252
include/xrpl/protocol_autogen/ledger_entries/Firewall.h
Normal 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
|
||||
252
include/xrpl/protocol_autogen/ledger_entries/WithdrawPreauth.h
Normal file
252
include/xrpl/protocol_autogen/ledger_entries/WithdrawPreauth.h
Normal 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
|
||||
155
include/xrpl/protocol_autogen/transactions/FirewallDelete.h
Normal file
155
include/xrpl/protocol_autogen/transactions/FirewallDelete.h
Normal 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 FirewallDeleteBuilder;
|
||||
|
||||
/**
|
||||
* @brief Transaction: FirewallDelete
|
||||
*
|
||||
* Type: ttFIREWALL_DELETE (105)
|
||||
* Delegable: Delegation::NotDelegable
|
||||
* Amendment: featureFirewall
|
||||
* Privileges: Privilege::NoPriv
|
||||
*
|
||||
* Immutable wrapper around STTx providing type-safe field access.
|
||||
* Use FirewallDeleteBuilder to construct new transactions.
|
||||
*/
|
||||
class FirewallDelete : public TransactionBase
|
||||
{
|
||||
public:
|
||||
static constexpr xrpl::TxType txType = ttFIREWALL_DELETE;
|
||||
|
||||
/**
|
||||
* @brief Construct a FirewallDelete transaction wrapper from an existing STTx object.
|
||||
* @throws std::runtime_error if the transaction type doesn't match.
|
||||
*/
|
||||
explicit FirewallDelete(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 FirewallDelete");
|
||||
}
|
||||
}
|
||||
|
||||
// Transaction-specific field getters
|
||||
/**
|
||||
* @brief Get sfCounterpartySignature (SoeRequired)
|
||||
* @note This is an untyped field.
|
||||
* @return The field value.
|
||||
*/
|
||||
[[nodiscard]]
|
||||
STObject
|
||||
getCounterpartySignature() const
|
||||
{
|
||||
return this->tx_->getFieldObject(sfCounterpartySignature);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get sfFirewallID (SoeRequired)
|
||||
* @return The field value.
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT256::type::value_type
|
||||
getFirewallID() const
|
||||
{
|
||||
return this->tx_->at(sfFirewallID);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Builder for FirewallDelete 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 FirewallDeleteBuilder : public TransactionBuilderBase<FirewallDeleteBuilder>
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* @brief Construct a new FirewallDeleteBuilder with required fields.
|
||||
* @param account The account initiating the transaction.
|
||||
* @param counterpartySignature The sfCounterpartySignature field value.
|
||||
* @param firewallID The sfFirewallID field value.
|
||||
* @param sequence Optional sequence number for the transaction.
|
||||
* @param fee Optional fee for the transaction.
|
||||
*/
|
||||
FirewallDeleteBuilder(SF_ACCOUNT::type::value_type account,
|
||||
STObject const& counterpartySignature, std::decay_t<typename SF_UINT256::type::value_type> const& firewallID, std::optional<SF_UINT32::type::value_type> sequence = std::nullopt,
|
||||
std::optional<SF_AMOUNT::type::value_type> fee = std::nullopt
|
||||
)
|
||||
: TransactionBuilderBase<FirewallDeleteBuilder>(ttFIREWALL_DELETE, account, sequence, fee)
|
||||
{
|
||||
setCounterpartySignature(counterpartySignature);
|
||||
setFirewallID(firewallID);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Construct a FirewallDeleteBuilder from an existing STTx object.
|
||||
* @param tx The existing transaction to copy from.
|
||||
* @throws std::runtime_error if the transaction type doesn't match.
|
||||
*/
|
||||
FirewallDeleteBuilder(std::shared_ptr<STTx const> tx)
|
||||
{
|
||||
if (tx->getTxnType() != ttFIREWALL_DELETE)
|
||||
{
|
||||
throw std::runtime_error("Invalid transaction type for FirewallDeleteBuilder");
|
||||
}
|
||||
object_ = *tx;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Transaction-specific field setters
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Set sfCounterpartySignature (SoeRequired)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
FirewallDeleteBuilder&
|
||||
setCounterpartySignature(STObject const& value)
|
||||
{
|
||||
object_.setFieldObject(sfCounterpartySignature, value);
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set sfFirewallID (SoeRequired)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
FirewallDeleteBuilder&
|
||||
setFirewallID(std::decay_t<typename SF_UINT256::type::value_type> const& value)
|
||||
{
|
||||
object_[sfFirewallID] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Build and return the FirewallDelete wrapper.
|
||||
* @param publicKey The public key for signing.
|
||||
* @param secretKey The secret key for signing.
|
||||
* @return The constructed transaction wrapper.
|
||||
*/
|
||||
FirewallDelete
|
||||
build(PublicKey const& publicKey, SecretKey const& secretKey)
|
||||
{
|
||||
sign(publicKey, secretKey);
|
||||
return FirewallDelete{std::make_shared<STTx>(std::move(object_))};
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::transactions
|
||||
327
include/xrpl/protocol_autogen/transactions/FirewallSet.h
Normal file
327
include/xrpl/protocol_autogen/transactions/FirewallSet.h
Normal file
@@ -0,0 +1,327 @@
|
||||
// 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 FirewallSetBuilder;
|
||||
|
||||
/**
|
||||
* @brief Transaction: FirewallSet
|
||||
*
|
||||
* Type: ttFIREWALL_SET (104)
|
||||
* Delegable: Delegation::NotDelegable
|
||||
* Amendment: featureFirewall
|
||||
* Privileges: Privilege::NoPriv
|
||||
*
|
||||
* Immutable wrapper around STTx providing type-safe field access.
|
||||
* Use FirewallSetBuilder to construct new transactions.
|
||||
*/
|
||||
class FirewallSet : public TransactionBase
|
||||
{
|
||||
public:
|
||||
static constexpr xrpl::TxType txType = ttFIREWALL_SET;
|
||||
|
||||
/**
|
||||
* @brief Construct a FirewallSet transaction wrapper from an existing STTx object.
|
||||
* @throws std::runtime_error if the transaction type doesn't match.
|
||||
*/
|
||||
explicit FirewallSet(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 FirewallSet");
|
||||
}
|
||||
}
|
||||
|
||||
// Transaction-specific field getters
|
||||
|
||||
/**
|
||||
* @brief Get sfCounterparty (SoeOptional)
|
||||
* @return The field value, or std::nullopt if not present.
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_ACCOUNT::type::value_type>
|
||||
getCounterparty() const
|
||||
{
|
||||
if (hasCounterparty())
|
||||
{
|
||||
return this->tx_->at(sfCounterparty);
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Check if sfCounterparty is present.
|
||||
* @return True if the field is present, false otherwise.
|
||||
*/
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasCounterparty() const
|
||||
{
|
||||
return this->tx_->isFieldPresent(sfCounterparty);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get sfBackup (SoeOptional)
|
||||
* @return The field value, or std::nullopt if not present.
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_ACCOUNT::type::value_type>
|
||||
getBackup() const
|
||||
{
|
||||
if (hasBackup())
|
||||
{
|
||||
return this->tx_->at(sfBackup);
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Check if sfBackup is present.
|
||||
* @return True if the field is present, false otherwise.
|
||||
*/
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasBackup() const
|
||||
{
|
||||
return this->tx_->isFieldPresent(sfBackup);
|
||||
}
|
||||
|
||||
/**
|
||||
* @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->tx_->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->tx_->isFieldPresent(sfMaxFee);
|
||||
}
|
||||
|
||||
/**
|
||||
* @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->tx_->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->tx_->isFieldPresent(sfDestinationTag);
|
||||
}
|
||||
/**
|
||||
* @brief Get sfCounterpartySignature (SoeOptional)
|
||||
* @note This is an untyped field.
|
||||
* @return The field value, or std::nullopt if not present.
|
||||
*/
|
||||
[[nodiscard]]
|
||||
std::optional<STObject>
|
||||
getCounterpartySignature() const
|
||||
{
|
||||
if (this->tx_->isFieldPresent(sfCounterpartySignature))
|
||||
return this->tx_->getFieldObject(sfCounterpartySignature);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Check if sfCounterpartySignature is present.
|
||||
* @return True if the field is present, false otherwise.
|
||||
*/
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasCounterpartySignature() const
|
||||
{
|
||||
return this->tx_->isFieldPresent(sfCounterpartySignature);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get sfFirewallID (SoeOptional)
|
||||
* @return The field value, or std::nullopt if not present.
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_UINT256::type::value_type>
|
||||
getFirewallID() const
|
||||
{
|
||||
if (hasFirewallID())
|
||||
{
|
||||
return this->tx_->at(sfFirewallID);
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Check if sfFirewallID is present.
|
||||
* @return True if the field is present, false otherwise.
|
||||
*/
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasFirewallID() const
|
||||
{
|
||||
return this->tx_->isFieldPresent(sfFirewallID);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Builder for FirewallSet 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 FirewallSetBuilder : public TransactionBuilderBase<FirewallSetBuilder>
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* @brief Construct a new FirewallSetBuilder with required fields.
|
||||
* @param account The account initiating the transaction.
|
||||
* @param sequence Optional sequence number for the transaction.
|
||||
* @param fee Optional fee for the transaction.
|
||||
*/
|
||||
FirewallSetBuilder(SF_ACCOUNT::type::value_type account,
|
||||
std::optional<SF_UINT32::type::value_type> sequence = std::nullopt,
|
||||
std::optional<SF_AMOUNT::type::value_type> fee = std::nullopt
|
||||
)
|
||||
: TransactionBuilderBase<FirewallSetBuilder>(ttFIREWALL_SET, account, sequence, fee)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Construct a FirewallSetBuilder from an existing STTx object.
|
||||
* @param tx The existing transaction to copy from.
|
||||
* @throws std::runtime_error if the transaction type doesn't match.
|
||||
*/
|
||||
FirewallSetBuilder(std::shared_ptr<STTx const> tx)
|
||||
{
|
||||
if (tx->getTxnType() != ttFIREWALL_SET)
|
||||
{
|
||||
throw std::runtime_error("Invalid transaction type for FirewallSetBuilder");
|
||||
}
|
||||
object_ = *tx;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Transaction-specific field setters
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Set sfCounterparty (SoeOptional)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
FirewallSetBuilder&
|
||||
setCounterparty(std::decay_t<typename SF_ACCOUNT::type::value_type> const& value)
|
||||
{
|
||||
object_[sfCounterparty] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set sfBackup (SoeOptional)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
FirewallSetBuilder&
|
||||
setBackup(std::decay_t<typename SF_ACCOUNT::type::value_type> const& value)
|
||||
{
|
||||
object_[sfBackup] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set sfMaxFee (SoeOptional)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
FirewallSetBuilder&
|
||||
setMaxFee(std::decay_t<typename SF_AMOUNT::type::value_type> const& value)
|
||||
{
|
||||
object_[sfMaxFee] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set sfDestinationTag (SoeOptional)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
FirewallSetBuilder&
|
||||
setDestinationTag(std::decay_t<typename SF_UINT32::type::value_type> const& value)
|
||||
{
|
||||
object_[sfDestinationTag] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set sfCounterpartySignature (SoeOptional)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
FirewallSetBuilder&
|
||||
setCounterpartySignature(STObject const& value)
|
||||
{
|
||||
object_.setFieldObject(sfCounterpartySignature, value);
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set sfFirewallID (SoeOptional)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
FirewallSetBuilder&
|
||||
setFirewallID(std::decay_t<typename SF_UINT256::type::value_type> const& value)
|
||||
{
|
||||
object_[sfFirewallID] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Build and return the FirewallSet wrapper.
|
||||
* @param publicKey The public key for signing.
|
||||
* @param secretKey The secret key for signing.
|
||||
* @return The constructed transaction wrapper.
|
||||
*/
|
||||
FirewallSet
|
||||
build(PublicKey const& publicKey, SecretKey const& secretKey)
|
||||
{
|
||||
sign(publicKey, secretKey);
|
||||
return FirewallSet{std::make_shared<STTx>(std::move(object_))};
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::transactions
|
||||
266
include/xrpl/protocol_autogen/transactions/WithdrawPreauth.h
Normal file
266
include/xrpl/protocol_autogen/transactions/WithdrawPreauth.h
Normal file
@@ -0,0 +1,266 @@
|
||||
// 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 WithdrawPreauthBuilder;
|
||||
|
||||
/**
|
||||
* @brief Transaction: WithdrawPreauth
|
||||
*
|
||||
* Type: ttWITHDRAW_PREAUTH (103)
|
||||
* Delegable: Delegation::NotDelegable
|
||||
* Amendment: featureFirewall
|
||||
* Privileges: Privilege::NoPriv
|
||||
*
|
||||
* Immutable wrapper around STTx providing type-safe field access.
|
||||
* Use WithdrawPreauthBuilder to construct new transactions.
|
||||
*/
|
||||
class WithdrawPreauth : public TransactionBase
|
||||
{
|
||||
public:
|
||||
static constexpr xrpl::TxType txType = ttWITHDRAW_PREAUTH;
|
||||
|
||||
/**
|
||||
* @brief Construct a WithdrawPreauth transaction wrapper from an existing STTx object.
|
||||
* @throws std::runtime_error if the transaction type doesn't match.
|
||||
*/
|
||||
explicit WithdrawPreauth(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 WithdrawPreauth");
|
||||
}
|
||||
}
|
||||
|
||||
// Transaction-specific field getters
|
||||
|
||||
/**
|
||||
* @brief Get sfAuthorize (SoeOptional)
|
||||
* @return The field value, or std::nullopt if not present.
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_ACCOUNT::type::value_type>
|
||||
getAuthorize() const
|
||||
{
|
||||
if (hasAuthorize())
|
||||
{
|
||||
return this->tx_->at(sfAuthorize);
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Check if sfAuthorize is present.
|
||||
* @return True if the field is present, false otherwise.
|
||||
*/
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasAuthorize() const
|
||||
{
|
||||
return this->tx_->isFieldPresent(sfAuthorize);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get sfUnauthorize (SoeOptional)
|
||||
* @return The field value, or std::nullopt if not present.
|
||||
*/
|
||||
[[nodiscard]]
|
||||
protocol_autogen::Optional<SF_ACCOUNT::type::value_type>
|
||||
getUnauthorize() const
|
||||
{
|
||||
if (hasUnauthorize())
|
||||
{
|
||||
return this->tx_->at(sfUnauthorize);
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Check if sfUnauthorize is present.
|
||||
* @return True if the field is present, false otherwise.
|
||||
*/
|
||||
[[nodiscard]]
|
||||
bool
|
||||
hasUnauthorize() const
|
||||
{
|
||||
return this->tx_->isFieldPresent(sfUnauthorize);
|
||||
}
|
||||
|
||||
/**
|
||||
* @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->tx_->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->tx_->isFieldPresent(sfDestinationTag);
|
||||
}
|
||||
/**
|
||||
* @brief Get sfCounterpartySignature (SoeRequired)
|
||||
* @note This is an untyped field.
|
||||
* @return The field value.
|
||||
*/
|
||||
[[nodiscard]]
|
||||
STObject
|
||||
getCounterpartySignature() const
|
||||
{
|
||||
return this->tx_->getFieldObject(sfCounterpartySignature);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get sfFirewallID (SoeRequired)
|
||||
* @return The field value.
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SF_UINT256::type::value_type
|
||||
getFirewallID() const
|
||||
{
|
||||
return this->tx_->at(sfFirewallID);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Builder for WithdrawPreauth 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 WithdrawPreauthBuilder : public TransactionBuilderBase<WithdrawPreauthBuilder>
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* @brief Construct a new WithdrawPreauthBuilder with required fields.
|
||||
* @param account The account initiating the transaction.
|
||||
* @param counterpartySignature The sfCounterpartySignature field value.
|
||||
* @param firewallID The sfFirewallID field value.
|
||||
* @param sequence Optional sequence number for the transaction.
|
||||
* @param fee Optional fee for the transaction.
|
||||
*/
|
||||
WithdrawPreauthBuilder(SF_ACCOUNT::type::value_type account,
|
||||
STObject const& counterpartySignature, std::decay_t<typename SF_UINT256::type::value_type> const& firewallID, std::optional<SF_UINT32::type::value_type> sequence = std::nullopt,
|
||||
std::optional<SF_AMOUNT::type::value_type> fee = std::nullopt
|
||||
)
|
||||
: TransactionBuilderBase<WithdrawPreauthBuilder>(ttWITHDRAW_PREAUTH, account, sequence, fee)
|
||||
{
|
||||
setCounterpartySignature(counterpartySignature);
|
||||
setFirewallID(firewallID);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Construct a WithdrawPreauthBuilder from an existing STTx object.
|
||||
* @param tx The existing transaction to copy from.
|
||||
* @throws std::runtime_error if the transaction type doesn't match.
|
||||
*/
|
||||
WithdrawPreauthBuilder(std::shared_ptr<STTx const> tx)
|
||||
{
|
||||
if (tx->getTxnType() != ttWITHDRAW_PREAUTH)
|
||||
{
|
||||
throw std::runtime_error("Invalid transaction type for WithdrawPreauthBuilder");
|
||||
}
|
||||
object_ = *tx;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Transaction-specific field setters
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Set sfAuthorize (SoeOptional)
|
||||
* @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 sfUnauthorize (SoeOptional)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
WithdrawPreauthBuilder&
|
||||
setUnauthorize(std::decay_t<typename SF_ACCOUNT::type::value_type> const& value)
|
||||
{
|
||||
object_[sfUnauthorize] = 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 sfCounterpartySignature (SoeRequired)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
WithdrawPreauthBuilder&
|
||||
setCounterpartySignature(STObject const& value)
|
||||
{
|
||||
object_.setFieldObject(sfCounterpartySignature, value);
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set sfFirewallID (SoeRequired)
|
||||
* @return Reference to this builder for method chaining.
|
||||
*/
|
||||
WithdrawPreauthBuilder&
|
||||
setFirewallID(std::decay_t<typename SF_UINT256::type::value_type> const& value)
|
||||
{
|
||||
object_[sfFirewallID] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Build and return the WithdrawPreauth wrapper.
|
||||
* @param publicKey The public key for signing.
|
||||
* @param secretKey The secret key for signing.
|
||||
* @return The constructed transaction wrapper.
|
||||
*/
|
||||
WithdrawPreauth
|
||||
build(PublicKey const& publicKey, SecretKey const& secretKey)
|
||||
{
|
||||
sign(publicKey, secretKey);
|
||||
return WithdrawPreauth{std::make_shared<STTx>(std::move(object_))};
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::transactions
|
||||
@@ -364,6 +364,15 @@ public:
|
||||
static NotTEC
|
||||
checkSponsor(ReadView const& view, STTx const& tx);
|
||||
|
||||
/**
|
||||
* Applies the account's firewall, if it has one, to this transaction.
|
||||
*
|
||||
* Returns tefFIREWALL_BLOCK when the firewall rejects it, so a blocked
|
||||
* transaction is not applied and claims no fee.
|
||||
*/
|
||||
static NotTEC
|
||||
checkFirewall(PreclaimContext const& ctx);
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
// Interface used by AccountDelete
|
||||
|
||||
37
include/xrpl/tx/invariants/FirewallInvariant.h
Normal file
37
include/xrpl/tx/invariants/FirewallInvariant.h
Normal file
@@ -0,0 +1,37 @@
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/beast/utility/Journal.h>
|
||||
#include <xrpl/ledger/ReadView.h>
|
||||
#include <xrpl/protocol/STLedgerEntry.h>
|
||||
#include <xrpl/protocol/STTx.h>
|
||||
#include <xrpl/protocol/TER.h>
|
||||
#include <xrpl/protocol/XRPAmount.h>
|
||||
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
namespace xrpl {
|
||||
|
||||
/**
|
||||
* A firewall keeps its owner and its counterparty.
|
||||
*
|
||||
* Every Firewall entry names a counterparty, because without one no update or
|
||||
* deletion could ever be authorized and the account's value would be stranded.
|
||||
* The owner is fixed at creation, so a firewall cannot be moved to another
|
||||
* account, and the counterparty is never the owner, which would let the owner
|
||||
* authorize its own updates.
|
||||
*/
|
||||
class ValidFirewall
|
||||
{
|
||||
// <before, after>. before is unseated when the entry is being created.
|
||||
std::vector<std::pair<SLE::const_pointer, SLE::const_pointer>> firewalls_;
|
||||
|
||||
public:
|
||||
void
|
||||
visitEntry(bool, SLE::const_ref, SLE::const_ref);
|
||||
|
||||
bool
|
||||
finalize(STTx const&, TER const, XRPAmount const, ReadView const&, beast::Journal const&);
|
||||
};
|
||||
|
||||
} // namespace xrpl
|
||||
@@ -8,6 +8,7 @@
|
||||
#include <xrpl/protocol/XRPAmount.h>
|
||||
#include <xrpl/tx/invariants/AMMInvariant.h>
|
||||
#include <xrpl/tx/invariants/DirectoryInvariant.h>
|
||||
#include <xrpl/tx/invariants/FirewallInvariant.h>
|
||||
#include <xrpl/tx/invariants/FreezeInvariant.h>
|
||||
#include <xrpl/tx/invariants/LoanBrokerInvariant.h>
|
||||
#include <xrpl/tx/invariants/LoanInvariant.h>
|
||||
@@ -448,6 +449,7 @@ using InvariantChecks = std::tuple<
|
||||
NFTokenCountTracking,
|
||||
ValidClawback,
|
||||
ValidMPTIssuance,
|
||||
ValidFirewall,
|
||||
ValidPermissionedDomain,
|
||||
ValidPermissionedDEX,
|
||||
ValidBookDirectory,
|
||||
|
||||
57
include/xrpl/tx/transactors/firewall/FirewallDelete.h
Normal file
57
include/xrpl/tx/transactors/firewall/FirewallDelete.h
Normal file
@@ -0,0 +1,57 @@
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/beast/utility/Journal.h>
|
||||
#include <xrpl/ledger/ReadView.h>
|
||||
#include <xrpl/protocol/STLedgerEntry.h>
|
||||
#include <xrpl/protocol/STTx.h>
|
||||
#include <xrpl/protocol/TER.h>
|
||||
#include <xrpl/protocol/XRPAmount.h>
|
||||
#include <xrpl/tx/ApplyContext.h>
|
||||
#include <xrpl/tx/Transactor.h>
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace xrpl {
|
||||
|
||||
/**
|
||||
* Deletes an account's firewall and every withdraw preauthorization it owns.
|
||||
*
|
||||
* The counterparty recorded on the firewall must countersign.
|
||||
*/
|
||||
class FirewallDelete : public Transactor
|
||||
{
|
||||
public:
|
||||
static constexpr auto kConsequencesFactory = ConsequencesFactoryType::Normal;
|
||||
|
||||
explicit FirewallDelete(ApplyContext& ctx) : Transactor(ctx)
|
||||
{
|
||||
}
|
||||
|
||||
static std::uint32_t
|
||||
getFlagsMask(PreflightContext const& ctx);
|
||||
|
||||
static XRPAmount
|
||||
calculateBaseFee(ReadView const& view, STTx const& tx);
|
||||
|
||||
static NotTEC
|
||||
preflight(PreflightContext const& ctx);
|
||||
|
||||
static TER
|
||||
preclaim(PreclaimContext const& ctx);
|
||||
|
||||
TER
|
||||
doApply() override;
|
||||
|
||||
void
|
||||
visitInvariantEntry(bool isDelete, SLE::const_ref before, SLE::const_ref after) override;
|
||||
|
||||
[[nodiscard]] bool
|
||||
finalizeInvariants(
|
||||
STTx const& tx,
|
||||
TER result,
|
||||
XRPAmount fee,
|
||||
ReadView const& view,
|
||||
beast::Journal const& j) override;
|
||||
};
|
||||
|
||||
} // namespace xrpl
|
||||
67
include/xrpl/tx/transactors/firewall/FirewallSet.h
Normal file
67
include/xrpl/tx/transactors/firewall/FirewallSet.h
Normal file
@@ -0,0 +1,67 @@
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/beast/utility/Journal.h>
|
||||
#include <xrpl/ledger/ReadView.h>
|
||||
#include <xrpl/protocol/STLedgerEntry.h>
|
||||
#include <xrpl/protocol/STTx.h>
|
||||
#include <xrpl/protocol/TER.h>
|
||||
#include <xrpl/protocol/XRPAmount.h>
|
||||
#include <xrpl/tx/ApplyContext.h>
|
||||
#include <xrpl/tx/Transactor.h>
|
||||
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
|
||||
namespace xrpl {
|
||||
|
||||
/**
|
||||
* Creates an account's firewall, or updates one that already exists.
|
||||
*
|
||||
* A create names the counterparty and the backup destination and needs no
|
||||
* counterparty signature. An update carries sfFirewallID and must be
|
||||
* countersigned by the counterparty recorded on the firewall.
|
||||
*/
|
||||
class FirewallSet : public Transactor
|
||||
{
|
||||
public:
|
||||
static constexpr auto kConsequencesFactory = ConsequencesFactoryType::Normal;
|
||||
|
||||
explicit FirewallSet(ApplyContext& ctx) : Transactor(ctx)
|
||||
{
|
||||
}
|
||||
|
||||
static std::uint32_t
|
||||
getFlagsMask(PreflightContext const& ctx);
|
||||
|
||||
static XRPAmount
|
||||
calculateBaseFee(ReadView const& view, STTx const& tx);
|
||||
|
||||
static NotTEC
|
||||
preflight(PreflightContext const& ctx);
|
||||
|
||||
static TER
|
||||
preclaim(PreclaimContext const& ctx);
|
||||
|
||||
TER
|
||||
doApply() override;
|
||||
|
||||
void
|
||||
visitInvariantEntry(bool isDelete, SLE::const_ref before, SLE::const_ref after) override;
|
||||
|
||||
[[nodiscard]] bool
|
||||
finalizeInvariants(
|
||||
STTx const& tx,
|
||||
TER result,
|
||||
XRPAmount fee,
|
||||
ReadView const& view,
|
||||
beast::Journal const& j) override;
|
||||
|
||||
private:
|
||||
TER
|
||||
createFirewall(std::shared_ptr<SLE> const& sleOwner);
|
||||
|
||||
TER
|
||||
updateFirewall();
|
||||
};
|
||||
|
||||
} // namespace xrpl
|
||||
68
include/xrpl/tx/transactors/firewall/WithdrawPreauth.h
Normal file
68
include/xrpl/tx/transactors/firewall/WithdrawPreauth.h
Normal file
@@ -0,0 +1,68 @@
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/basics/base_uint.h>
|
||||
#include <xrpl/beast/utility/Journal.h>
|
||||
#include <xrpl/ledger/ApplyView.h>
|
||||
#include <xrpl/ledger/ReadView.h>
|
||||
#include <xrpl/protocol/STLedgerEntry.h>
|
||||
#include <xrpl/protocol/STTx.h>
|
||||
#include <xrpl/protocol/TER.h>
|
||||
#include <xrpl/protocol/XRPAmount.h>
|
||||
#include <xrpl/tx/ApplyContext.h>
|
||||
#include <xrpl/tx/Transactor.h>
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace xrpl {
|
||||
|
||||
/**
|
||||
* Authorizes or unauthorizes one destination of a firewalled account.
|
||||
*
|
||||
* The counterparty recorded on the account's firewall must countersign, so an
|
||||
* account whose keys are stolen cannot add a destination on its own.
|
||||
*/
|
||||
class WithdrawPreauth : public Transactor
|
||||
{
|
||||
public:
|
||||
static constexpr auto kConsequencesFactory = ConsequencesFactoryType::Normal;
|
||||
|
||||
explicit WithdrawPreauth(ApplyContext& ctx) : Transactor(ctx)
|
||||
{
|
||||
}
|
||||
|
||||
static std::uint32_t
|
||||
getFlagsMask(PreflightContext const& ctx);
|
||||
|
||||
static XRPAmount
|
||||
calculateBaseFee(ReadView const& view, STTx const& tx);
|
||||
|
||||
static NotTEC
|
||||
preflight(PreflightContext const& ctx);
|
||||
|
||||
static TER
|
||||
preclaim(PreclaimContext const& ctx);
|
||||
|
||||
TER
|
||||
doApply() override;
|
||||
|
||||
/**
|
||||
* Removes one withdraw preauthorization and returns its reserve.
|
||||
*
|
||||
* Also called when the firewall itself is deleted.
|
||||
*/
|
||||
static TER
|
||||
removeFromLedger(ApplyView& view, uint256 const& preauthIndex, beast::Journal j);
|
||||
|
||||
void
|
||||
visitInvariantEntry(bool isDelete, SLE::const_ref before, SLE::const_ref after) override;
|
||||
|
||||
[[nodiscard]] bool
|
||||
finalizeInvariants(
|
||||
STTx const& tx,
|
||||
TER result,
|
||||
XRPAmount fee,
|
||||
ReadView const& view,
|
||||
beast::Journal const& j) override;
|
||||
};
|
||||
|
||||
} // namespace xrpl
|
||||
Reference in New Issue
Block a user