nit: fix spacing (#7594)

This commit is contained in:
Mayukha Vadari
2026-06-23 00:17:32 -04:00
committed by GitHub
parent 018e736a3b
commit 05d3614a19
4 changed files with 214 additions and 214 deletions

View File

@@ -127,32 +127,32 @@ LEDGER_ENTRY(ltTICKET, 0x0054, Ticket, ticket, ({
\sa keylet::account
*/
LEDGER_ENTRY(ltACCOUNT_ROOT, 0x0061, AccountRoot, account, ({
{sfAccount, SoeRequired},
{sfSequence, SoeRequired},
{sfBalance, SoeRequired},
{sfOwnerCount, SoeRequired},
{sfPreviousTxnID, SoeRequired},
{sfPreviousTxnLgrSeq, SoeRequired},
{sfAccountTxnID, SoeOptional},
{sfRegularKey, SoeOptional},
{sfEmailHash, SoeOptional},
{sfWalletLocator, SoeOptional},
{sfWalletSize, SoeOptional},
{sfMessageKey, SoeOptional},
{sfTransferRate, SoeOptional},
{sfDomain, SoeOptional},
{sfTickSize, SoeOptional},
{sfTicketCount, SoeOptional},
{sfNFTokenMinter, SoeOptional},
{sfMintedNFTokens, SoeDefault},
{sfBurnedNFTokens, SoeDefault},
{sfFirstNFTokenSequence, SoeOptional},
{sfAMMID, SoeOptional}, // pseudo-account designator
{sfVaultID, SoeOptional}, // pseudo-account designator
{sfLoanBrokerID, SoeOptional}, // pseudo-account designator
{sfSponsoredOwnerCount, SoeDefault},
{sfSponsoringOwnerCount, SoeDefault},
{sfSponsoringAccountCount,SoeDefault},
{sfAccount, SoeRequired},
{sfSequence, SoeRequired},
{sfBalance, SoeRequired},
{sfOwnerCount, SoeRequired},
{sfPreviousTxnID, SoeRequired},
{sfPreviousTxnLgrSeq, SoeRequired},
{sfAccountTxnID, SoeOptional},
{sfRegularKey, SoeOptional},
{sfEmailHash, SoeOptional},
{sfWalletLocator, SoeOptional},
{sfWalletSize, SoeOptional},
{sfMessageKey, SoeOptional},
{sfTransferRate, SoeOptional},
{sfDomain, SoeOptional},
{sfTickSize, SoeOptional},
{sfTicketCount, SoeOptional},
{sfNFTokenMinter, SoeOptional},
{sfMintedNFTokens, SoeDefault},
{sfBurnedNFTokens, SoeDefault},
{sfFirstNFTokenSequence, SoeOptional},
{sfSponsoredOwnerCount, SoeDefault},
{sfSponsoringOwnerCount, SoeDefault},
{sfSponsoringAccountCount, SoeDefault},
{sfAMMID, SoeOptional}, // pseudo-account designator
{sfVaultID, SoeOptional}, // pseudo-account designator
{sfLoanBrokerID, SoeOptional}, // pseudo-account designator
}))
/** A ledger object which contains a list of object identifiers.
@@ -622,7 +622,7 @@ LEDGER_ENTRY(ltSPONSORSHIP, 0x0090, Sponsorship, sponsorship, ({
{sfSponsee, SoeRequired},
{sfFeeAmount, SoeOptional},
{sfMaxFee, SoeOptional},
{sfRemainingOwnerCount, SoeDefault},
{sfRemainingOwnerCount, SoeDefault},
{sfOwnerNode, SoeRequired},
{sfSponseeNode, SoeRequired},
}))

View File

@@ -116,7 +116,7 @@ TYPED_SFIELD(sfOverpaymentInterestRate, UINT32, 68) // 1/10 basis points (bi
TYPED_SFIELD(sfSponsoredOwnerCount, UINT32, 69)
TYPED_SFIELD(sfSponsoringOwnerCount, UINT32, 70)
TYPED_SFIELD(sfSponsoringAccountCount, UINT32, 71)
TYPED_SFIELD(sfRemainingOwnerCount, UINT32, 72)
TYPED_SFIELD(sfRemainingOwnerCount, UINT32, 72)
TYPED_SFIELD(sfSponsorFlags, UINT32, 73)
// 64-bit integers (common)

View File

@@ -447,78 +447,6 @@ public:
return this->sle_->isFieldPresent(sfFirstNFTokenSequence);
}
/**
* @brief Get sfAMMID (SoeOptional)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
protocol_autogen::Optional<SF_UINT256::type::value_type>
getAMMID() const
{
if (hasAMMID())
return this->sle_->at(sfAMMID);
return std::nullopt;
}
/**
* @brief Check if sfAMMID is present.
* @return True if the field is present, false otherwise.
*/
[[nodiscard]]
bool
hasAMMID() const
{
return this->sle_->isFieldPresent(sfAMMID);
}
/**
* @brief Get sfVaultID (SoeOptional)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
protocol_autogen::Optional<SF_UINT256::type::value_type>
getVaultID() const
{
if (hasVaultID())
return this->sle_->at(sfVaultID);
return std::nullopt;
}
/**
* @brief Check if sfVaultID is present.
* @return True if the field is present, false otherwise.
*/
[[nodiscard]]
bool
hasVaultID() const
{
return this->sle_->isFieldPresent(sfVaultID);
}
/**
* @brief Get sfLoanBrokerID (SoeOptional)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
protocol_autogen::Optional<SF_UINT256::type::value_type>
getLoanBrokerID() const
{
if (hasLoanBrokerID())
return this->sle_->at(sfLoanBrokerID);
return std::nullopt;
}
/**
* @brief Check if sfLoanBrokerID is present.
* @return True if the field is present, false otherwise.
*/
[[nodiscard]]
bool
hasLoanBrokerID() const
{
return this->sle_->isFieldPresent(sfLoanBrokerID);
}
/**
* @brief Get sfSponsoredOwnerCount (SoeDefault)
* @return The field value, or std::nullopt if not present.
@@ -590,6 +518,78 @@ public:
{
return this->sle_->isFieldPresent(sfSponsoringAccountCount);
}
/**
* @brief Get sfAMMID (SoeOptional)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
protocol_autogen::Optional<SF_UINT256::type::value_type>
getAMMID() const
{
if (hasAMMID())
return this->sle_->at(sfAMMID);
return std::nullopt;
}
/**
* @brief Check if sfAMMID is present.
* @return True if the field is present, false otherwise.
*/
[[nodiscard]]
bool
hasAMMID() const
{
return this->sle_->isFieldPresent(sfAMMID);
}
/**
* @brief Get sfVaultID (SoeOptional)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
protocol_autogen::Optional<SF_UINT256::type::value_type>
getVaultID() const
{
if (hasVaultID())
return this->sle_->at(sfVaultID);
return std::nullopt;
}
/**
* @brief Check if sfVaultID is present.
* @return True if the field is present, false otherwise.
*/
[[nodiscard]]
bool
hasVaultID() const
{
return this->sle_->isFieldPresent(sfVaultID);
}
/**
* @brief Get sfLoanBrokerID (SoeOptional)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
protocol_autogen::Optional<SF_UINT256::type::value_type>
getLoanBrokerID() const
{
if (hasLoanBrokerID())
return this->sle_->at(sfLoanBrokerID);
return std::nullopt;
}
/**
* @brief Check if sfLoanBrokerID is present.
* @return True if the field is present, false otherwise.
*/
[[nodiscard]]
bool
hasLoanBrokerID() const
{
return this->sle_->isFieldPresent(sfLoanBrokerID);
}
};
/**
@@ -858,39 +858,6 @@ public:
return *this;
}
/**
* @brief Set sfAMMID (SoeOptional)
* @return Reference to this builder for method chaining.
*/
AccountRootBuilder&
setAMMID(std::decay_t<typename SF_UINT256::type::value_type> const& value)
{
object_[sfAMMID] = value;
return *this;
}
/**
* @brief Set sfVaultID (SoeOptional)
* @return Reference to this builder for method chaining.
*/
AccountRootBuilder&
setVaultID(std::decay_t<typename SF_UINT256::type::value_type> const& value)
{
object_[sfVaultID] = value;
return *this;
}
/**
* @brief Set sfLoanBrokerID (SoeOptional)
* @return Reference to this builder for method chaining.
*/
AccountRootBuilder&
setLoanBrokerID(std::decay_t<typename SF_UINT256::type::value_type> const& value)
{
object_[sfLoanBrokerID] = value;
return *this;
}
/**
* @brief Set sfSponsoredOwnerCount (SoeDefault)
* @return Reference to this builder for method chaining.
@@ -924,6 +891,39 @@ public:
return *this;
}
/**
* @brief Set sfAMMID (SoeOptional)
* @return Reference to this builder for method chaining.
*/
AccountRootBuilder&
setAMMID(std::decay_t<typename SF_UINT256::type::value_type> const& value)
{
object_[sfAMMID] = value;
return *this;
}
/**
* @brief Set sfVaultID (SoeOptional)
* @return Reference to this builder for method chaining.
*/
AccountRootBuilder&
setVaultID(std::decay_t<typename SF_UINT256::type::value_type> const& value)
{
object_[sfVaultID] = value;
return *this;
}
/**
* @brief Set sfLoanBrokerID (SoeOptional)
* @return Reference to this builder for method chaining.
*/
AccountRootBuilder&
setLoanBrokerID(std::decay_t<typename SF_UINT256::type::value_type> const& value)
{
object_[sfLoanBrokerID] = value;
return *this;
}
/**
* @brief Build and return the completed AccountRoot wrapper.
* @param index The ledger entry index.

View File

@@ -40,12 +40,12 @@ TEST(AccountRootTests, BuilderSettersRoundTrip)
auto const mintedNFTokensValue = canonical_UINT32();
auto const burnedNFTokensValue = canonical_UINT32();
auto const firstNFTokenSequenceValue = canonical_UINT32();
auto const aMMIDValue = canonical_UINT256();
auto const vaultIDValue = canonical_UINT256();
auto const loanBrokerIDValue = canonical_UINT256();
auto const sponsoredOwnerCountValue = canonical_UINT32();
auto const sponsoringOwnerCountValue = canonical_UINT32();
auto const sponsoringAccountCountValue = canonical_UINT32();
auto const aMMIDValue = canonical_UINT256();
auto const vaultIDValue = canonical_UINT256();
auto const loanBrokerIDValue = canonical_UINT256();
AccountRootBuilder builder{
accountValue,
@@ -70,12 +70,12 @@ TEST(AccountRootTests, BuilderSettersRoundTrip)
builder.setMintedNFTokens(mintedNFTokensValue);
builder.setBurnedNFTokens(burnedNFTokensValue);
builder.setFirstNFTokenSequence(firstNFTokenSequenceValue);
builder.setAMMID(aMMIDValue);
builder.setVaultID(vaultIDValue);
builder.setLoanBrokerID(loanBrokerIDValue);
builder.setSponsoredOwnerCount(sponsoredOwnerCountValue);
builder.setSponsoringOwnerCount(sponsoringOwnerCountValue);
builder.setSponsoringAccountCount(sponsoringAccountCountValue);
builder.setAMMID(aMMIDValue);
builder.setVaultID(vaultIDValue);
builder.setLoanBrokerID(loanBrokerIDValue);
builder.setLedgerIndex(index);
builder.setFlags(0x1u);
@@ -234,30 +234,6 @@ TEST(AccountRootTests, BuilderSettersRoundTrip)
EXPECT_TRUE(entry.hasFirstNFTokenSequence());
}
{
auto const& expected = aMMIDValue;
auto const actualOpt = entry.getAMMID();
ASSERT_TRUE(actualOpt.has_value());
expectEqualField(expected, *actualOpt, "sfAMMID");
EXPECT_TRUE(entry.hasAMMID());
}
{
auto const& expected = vaultIDValue;
auto const actualOpt = entry.getVaultID();
ASSERT_TRUE(actualOpt.has_value());
expectEqualField(expected, *actualOpt, "sfVaultID");
EXPECT_TRUE(entry.hasVaultID());
}
{
auto const& expected = loanBrokerIDValue;
auto const actualOpt = entry.getLoanBrokerID();
ASSERT_TRUE(actualOpt.has_value());
expectEqualField(expected, *actualOpt, "sfLoanBrokerID");
EXPECT_TRUE(entry.hasLoanBrokerID());
}
{
auto const& expected = sponsoredOwnerCountValue;
auto const actualOpt = entry.getSponsoredOwnerCount();
@@ -282,6 +258,30 @@ TEST(AccountRootTests, BuilderSettersRoundTrip)
EXPECT_TRUE(entry.hasSponsoringAccountCount());
}
{
auto const& expected = aMMIDValue;
auto const actualOpt = entry.getAMMID();
ASSERT_TRUE(actualOpt.has_value());
expectEqualField(expected, *actualOpt, "sfAMMID");
EXPECT_TRUE(entry.hasAMMID());
}
{
auto const& expected = vaultIDValue;
auto const actualOpt = entry.getVaultID();
ASSERT_TRUE(actualOpt.has_value());
expectEqualField(expected, *actualOpt, "sfVaultID");
EXPECT_TRUE(entry.hasVaultID());
}
{
auto const& expected = loanBrokerIDValue;
auto const actualOpt = entry.getLoanBrokerID();
ASSERT_TRUE(actualOpt.has_value());
expectEqualField(expected, *actualOpt, "sfLoanBrokerID");
EXPECT_TRUE(entry.hasLoanBrokerID());
}
EXPECT_TRUE(entry.hasLedgerIndex());
auto const ledgerIndex = entry.getLedgerIndex();
ASSERT_TRUE(ledgerIndex.has_value());
@@ -315,12 +315,12 @@ TEST(AccountRootTests, BuilderFromSleRoundTrip)
auto const mintedNFTokensValue = canonical_UINT32();
auto const burnedNFTokensValue = canonical_UINT32();
auto const firstNFTokenSequenceValue = canonical_UINT32();
auto const aMMIDValue = canonical_UINT256();
auto const vaultIDValue = canonical_UINT256();
auto const loanBrokerIDValue = canonical_UINT256();
auto const sponsoredOwnerCountValue = canonical_UINT32();
auto const sponsoringOwnerCountValue = canonical_UINT32();
auto const sponsoringAccountCountValue = canonical_UINT32();
auto const aMMIDValue = canonical_UINT256();
auto const vaultIDValue = canonical_UINT256();
auto const loanBrokerIDValue = canonical_UINT256();
auto sle = std::make_shared<SLE>(AccountRoot::entryType, index);
@@ -344,12 +344,12 @@ TEST(AccountRootTests, BuilderFromSleRoundTrip)
sle->at(sfMintedNFTokens) = mintedNFTokensValue;
sle->at(sfBurnedNFTokens) = burnedNFTokensValue;
sle->at(sfFirstNFTokenSequence) = firstNFTokenSequenceValue;
sle->at(sfAMMID) = aMMIDValue;
sle->at(sfVaultID) = vaultIDValue;
sle->at(sfLoanBrokerID) = loanBrokerIDValue;
sle->at(sfSponsoredOwnerCount) = sponsoredOwnerCountValue;
sle->at(sfSponsoringOwnerCount) = sponsoringOwnerCountValue;
sle->at(sfSponsoringAccountCount) = sponsoringAccountCountValue;
sle->at(sfAMMID) = aMMIDValue;
sle->at(sfVaultID) = vaultIDValue;
sle->at(sfLoanBrokerID) = loanBrokerIDValue;
AccountRootBuilder builderFromSle{sle};
EXPECT_TRUE(builderFromSle.validate());
@@ -602,45 +602,6 @@ TEST(AccountRootTests, BuilderFromSleRoundTrip)
expectEqualField(expected, *fromBuilderOpt, "sfFirstNFTokenSequence");
}
{
auto const& expected = aMMIDValue;
auto const fromSleOpt = entryFromSle.getAMMID();
auto const fromBuilderOpt = entryFromBuilder.getAMMID();
ASSERT_TRUE(fromSleOpt.has_value());
ASSERT_TRUE(fromBuilderOpt.has_value());
expectEqualField(expected, *fromSleOpt, "sfAMMID");
expectEqualField(expected, *fromBuilderOpt, "sfAMMID");
}
{
auto const& expected = vaultIDValue;
auto const fromSleOpt = entryFromSle.getVaultID();
auto const fromBuilderOpt = entryFromBuilder.getVaultID();
ASSERT_TRUE(fromSleOpt.has_value());
ASSERT_TRUE(fromBuilderOpt.has_value());
expectEqualField(expected, *fromSleOpt, "sfVaultID");
expectEqualField(expected, *fromBuilderOpt, "sfVaultID");
}
{
auto const& expected = loanBrokerIDValue;
auto const fromSleOpt = entryFromSle.getLoanBrokerID();
auto const fromBuilderOpt = entryFromBuilder.getLoanBrokerID();
ASSERT_TRUE(fromSleOpt.has_value());
ASSERT_TRUE(fromBuilderOpt.has_value());
expectEqualField(expected, *fromSleOpt, "sfLoanBrokerID");
expectEqualField(expected, *fromBuilderOpt, "sfLoanBrokerID");
}
{
auto const& expected = sponsoredOwnerCountValue;
@@ -680,6 +641,45 @@ TEST(AccountRootTests, BuilderFromSleRoundTrip)
expectEqualField(expected, *fromBuilderOpt, "sfSponsoringAccountCount");
}
{
auto const& expected = aMMIDValue;
auto const fromSleOpt = entryFromSle.getAMMID();
auto const fromBuilderOpt = entryFromBuilder.getAMMID();
ASSERT_TRUE(fromSleOpt.has_value());
ASSERT_TRUE(fromBuilderOpt.has_value());
expectEqualField(expected, *fromSleOpt, "sfAMMID");
expectEqualField(expected, *fromBuilderOpt, "sfAMMID");
}
{
auto const& expected = vaultIDValue;
auto const fromSleOpt = entryFromSle.getVaultID();
auto const fromBuilderOpt = entryFromBuilder.getVaultID();
ASSERT_TRUE(fromSleOpt.has_value());
ASSERT_TRUE(fromBuilderOpt.has_value());
expectEqualField(expected, *fromSleOpt, "sfVaultID");
expectEqualField(expected, *fromBuilderOpt, "sfVaultID");
}
{
auto const& expected = loanBrokerIDValue;
auto const fromSleOpt = entryFromSle.getLoanBrokerID();
auto const fromBuilderOpt = entryFromBuilder.getLoanBrokerID();
ASSERT_TRUE(fromSleOpt.has_value());
ASSERT_TRUE(fromBuilderOpt.has_value());
expectEqualField(expected, *fromSleOpt, "sfLoanBrokerID");
expectEqualField(expected, *fromBuilderOpt, "sfLoanBrokerID");
}
EXPECT_EQ(entryFromSle.getKey(), index);
EXPECT_EQ(entryFromBuilder.getKey(), index);
}
@@ -772,17 +772,17 @@ TEST(AccountRootTests, OptionalFieldsReturnNullopt)
EXPECT_FALSE(entry.getBurnedNFTokens().has_value());
EXPECT_FALSE(entry.hasFirstNFTokenSequence());
EXPECT_FALSE(entry.getFirstNFTokenSequence().has_value());
EXPECT_FALSE(entry.hasAMMID());
EXPECT_FALSE(entry.getAMMID().has_value());
EXPECT_FALSE(entry.hasVaultID());
EXPECT_FALSE(entry.getVaultID().has_value());
EXPECT_FALSE(entry.hasLoanBrokerID());
EXPECT_FALSE(entry.getLoanBrokerID().has_value());
EXPECT_FALSE(entry.hasSponsoredOwnerCount());
EXPECT_FALSE(entry.getSponsoredOwnerCount().has_value());
EXPECT_FALSE(entry.hasSponsoringOwnerCount());
EXPECT_FALSE(entry.getSponsoringOwnerCount().has_value());
EXPECT_FALSE(entry.hasSponsoringAccountCount());
EXPECT_FALSE(entry.getSponsoringAccountCount().has_value());
EXPECT_FALSE(entry.hasAMMID());
EXPECT_FALSE(entry.getAMMID().has_value());
EXPECT_FALSE(entry.hasVaultID());
EXPECT_FALSE(entry.getVaultID().has_value());
EXPECT_FALSE(entry.hasLoanBrokerID());
EXPECT_FALSE(entry.getLoanBrokerID().has_value());
}
}