mirror of
https://github.com/XRPLF/rippled.git
synced 2026-06-03 08:46:46 +00:00
Add Asset and MPTIssue support to more jtx objects / functions
- Unfortunately, to work around some ambiguous symbol compilation errors, I had to change the implicit conversion from IOU to Asset to a conversion from IOU to PrettyAsset, and add a more explicit `asset()` function. This workaround only required changing two existing tests, so seems acceptable.
This commit is contained in:
@@ -199,6 +199,26 @@ Env::balance(Account const& account, Issue const& issue) const
|
||||
return {amount, lookup(issue.account).name()};
|
||||
}
|
||||
|
||||
PrettyAmount
|
||||
Env::balance(Account const& account, MPTIssue const& mptIssue) const
|
||||
{
|
||||
auto const sle = le(keylet::mptoken(mptIssue.getMptID(), account));
|
||||
if (!sle)
|
||||
{
|
||||
return {STAmount(mptIssue, 0), account.name()};
|
||||
}
|
||||
STAmount const amount{mptIssue, sle->getFieldU64(sfMPTAmount)};
|
||||
return {amount, lookup(mptIssue.getIssuer()).name()};
|
||||
}
|
||||
|
||||
PrettyAmount
|
||||
Env::balance(Account const& account, Asset const& asset) const
|
||||
{
|
||||
return std::visit(
|
||||
[&](auto const& issue) { return balance(account, issue); },
|
||||
asset.value());
|
||||
}
|
||||
|
||||
std::uint32_t
|
||||
Env::ownerCount(Account const& account) const
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user