diff --git a/include/xrpl/protocol/SField.h b/include/xrpl/protocol/SField.h index 849332ecc3c..db6ffd8d095 100644 --- a/include/xrpl/protocol/SField.h +++ b/include/xrpl/protocol/SField.h @@ -148,6 +148,7 @@ class SField sMD_DeleteFinal = 0x04, // final value when it is deleted sMD_Create = 0x08, // value when it's created sMD_Always = 0x10, // value when node containing it is affected at all + sMD_BaseTen = 0x20, sMD_Default = sMD_ChangeOrig | sMD_ChangeNew | sMD_DeleteFinal | sMD_Create }; diff --git a/src/libxrpl/protocol/SField.cpp b/src/libxrpl/protocol/SField.cpp index 85aca815acc..5a96afb937f 100644 --- a/src/libxrpl/protocol/SField.cpp +++ b/src/libxrpl/protocol/SField.cpp @@ -194,9 +194,9 @@ CONSTRUCT_TYPED_SFIELD(sfXChainClaimID, "XChainClaimID", U CONSTRUCT_TYPED_SFIELD(sfXChainAccountCreateCount, "XChainAccountCreateCount", UINT64, 21); CONSTRUCT_TYPED_SFIELD(sfXChainAccountClaimCount, "XChainAccountClaimCount", UINT64, 22); CONSTRUCT_TYPED_SFIELD(sfAssetPrice, "AssetPrice", UINT64, 23); -CONSTRUCT_TYPED_SFIELD(sfMaximumAmount, "MaximumAmount", UINT64, 24); -CONSTRUCT_TYPED_SFIELD(sfOutstandingAmount, "OutstandingAmount", UINT64, 25); -CONSTRUCT_TYPED_SFIELD(sfMPTAmount, "MPTAmount", UINT64, 26); +CONSTRUCT_TYPED_SFIELD(sfMaximumAmount, "MaximumAmount", UINT64, 24, SField::sMD_BaseTen); +CONSTRUCT_TYPED_SFIELD(sfOutstandingAmount, "OutstandingAmount", UINT64, 25, SField::sMD_BaseTen); +CONSTRUCT_TYPED_SFIELD(sfMPTAmount, "MPTAmount", UINT64, 26, SField::sMD_BaseTen); // 128-bit CONSTRUCT_TYPED_SFIELD(sfEmailHash, "EmailHash", UINT128, 1); diff --git a/src/libxrpl/protocol/STInteger.cpp b/src/libxrpl/protocol/STInteger.cpp index 2db4ff32c34..82ea6c7a9c8 100644 --- a/src/libxrpl/protocol/STInteger.cpp +++ b/src/libxrpl/protocol/STInteger.cpp @@ -205,8 +205,7 @@ Json::Value STUInt64::getJson(JsonOptions) const return str; }; - if (auto const& fName = getFName(); fName == sfMaximumAmount || - fName == sfOutstandingAmount || fName == sfMPTAmount) + if (auto const& fName = getFName(); fName.shouldMeta(SField::sMD_BaseTen)) { return convertToString(value_, 10); // Convert to base 10 } diff --git a/src/libxrpl/protocol/STParsedJSON.cpp b/src/libxrpl/protocol/STParsedJSON.cpp index 1ca4e83d9e6..8838c28e257 100644 --- a/src/libxrpl/protocol/STParsedJSON.cpp +++ b/src/libxrpl/protocol/STParsedJSON.cpp @@ -398,8 +398,7 @@ parseLeaf( std::uint64_t val; - bool const useBase10 = field == sfMaximumAmount || - field == sfOutstandingAmount || field == sfMPTAmount; + bool const useBase10 = field.shouldMeta(SField::sMD_BaseTen); // if the field is amount, serialize as base 10 auto [p, ec] = std::from_chars(