Skip to content

Chang UINT64 amounts to base 10 display#35

Merged
gregtatcam merged 7 commits intogregtatcam:feature/mpt-v1from
shawnxie999:mpt-uint64-base10
Sep 19, 2024
Merged

Chang UINT64 amounts to base 10 display#35
gregtatcam merged 7 commits intogregtatcam:feature/mpt-v1from
shawnxie999:mpt-uint64-base10

Conversation

@shawnxie999
Copy link
Copy Markdown

High Level Overview of Change

Context of Change

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Refactor (non-breaking change that only restructures code)
  • Performance (increase or change in throughput and/or latency)
  • Tests (you added tests for code that already exists, or your new feature included in this PR)
  • Documentation update
  • Chore (no impact to binary, e.g. .gitignore, formatting, dropping support for older tooling)
  • Release

API Impact

  • Public API: New feature (new methods and/or new fields)
  • Public API: Breaking change (in general, breaking changes should only impact the next api_version)
  • libxrpl change (any change that may affect libxrpl or dependents of libxrpl)
  • Peer protocol change (must be backward compatible or bump the peer protocol version)

@shawnxie999 shawnxie999 marked this pull request as ready for review September 13, 2024 13:59
@shawnxie999 shawnxie999 changed the title MPT amount base 10 Chang UINT64 amounts to base 10 display Sep 13, 2024
return str;
};

if (auto const& fName = getFName(); fName == sfMaximumAmount ||
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't feel right having ST* types having knowledge of specific fields. Is it the only way?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

STUInt16 has something similar, so i think this is fine

Json::Value STUInt16::getJson(JsonOptions) const
{
    if (getFName() == sfLedgerEntryType)
    {
        auto item = LedgerFormats::getInstance().findByType(
            safe_cast<LedgerEntryType>(value_));
        if (item != nullptr)
            return item->getName();
    }


std::uint64_t val;

bool const useBase10 = field == sfMaximumAmount ||
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same - generic type has knowledge of specific fields.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

struct MPTCreate
{
std::optional<std::int64_t> maxAmt = std::nullopt;
std::optional<std::string> maxAmt = std::nullopt;
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to change the type? Can just change when the value is formatted to the field.

@gregtatcam gregtatcam merged commit 921e978 into gregtatcam:feature/mpt-v1 Sep 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants