本文整理汇总了C++中STAmount::getJson方法的典型用法代码示例。如果您正苦于以下问题:C++ STAmount::getJson方法的具体用法?C++ STAmount::getJson怎么用?C++ STAmount::getJson使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类STAmount
的用法示例。
在下文中一共展示了STAmount::getJson方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
Json::Value
offer (Account const& account,
STAmount const& in, STAmount const& out)
{
Json::Value jv;
jv[jss::Account] = account.human();
jv[jss::TakerPays] = in.getJson(0);
jv[jss::TakerGets] = out.getJson(0);
jv[jss::TransactionType] = "OfferCreate";
return jv;
}
示例2: runtime_error
Json::Value
trust (Account const& account,
STAmount const& amount)
{
if (isXDV(amount))
throw std::runtime_error(
"trust() requires IOU");
Json::Value jv;
jv[jss::Account] = account.human();
jv[jss::LimitAmount] = amount.getJson(0);
jv[jss::TransactionType] = "TrustSet";
jv[jss::Flags] = 0; // tfClearNoDivvy;
return jv;
}
示例3: doUpdate
Json::Value PathRequest::doUpdate (RippleLineCache::ref cache, bool fast)
{
m_journal.debug << iIdentifier << " update " << (fast ? "fast" : "normal");
ScopedLockType sl (mLock);
if (!isValid (cache))
return jvStatus;
jvStatus = Json::objectValue;
auto sourceCurrencies = sciSourceCurrencies;
if (sourceCurrencies.empty ())
{
auto usCurrencies =
usAccountSourceCurrencies (raSrcAccount, cache, true);
bool sameAccount = raSrcAccount == raDstAccount;
for (auto const& c: usCurrencies)
{
if (!sameAccount || (c != saDstAmount.getCurrency ()))
{
if (c.isZero ())
sourceCurrencies.insert (std::make_pair (c, xrpAccount()));
else
sourceCurrencies.insert (std::make_pair (c, raSrcAccount.getAccountID ()));
}
}
}
jvStatus["source_account"] = raSrcAccount.humanAccountID ();
jvStatus["destination_account"] = raDstAccount.humanAccountID ();
jvStatus["destination_amount"] = saDstAmount.getJson (0);
if (!jvId.isNull ())
jvStatus["id"] = jvId;
Json::Value jvArray = Json::arrayValue;
int iLevel = iLastLevel;
bool loaded = getApp().getFeeTrack().isLoadedLocal();
if (iLevel == 0)
{ // first pass
if (loaded || fast)
iLevel = getConfig().PATH_SEARCH_FAST;
else
iLevel = getConfig().PATH_SEARCH;
}
else if ((iLevel == getConfig().PATH_SEARCH_FAST) && !fast)
{ // leaving fast pathfinding
iLevel = getConfig().PATH_SEARCH;
if (loaded && (iLevel > getConfig().PATH_SEARCH_FAST))
--iLevel;
}
else if (bLastSuccess)
{ // decrement, if possible
if (iLevel > getConfig().PATH_SEARCH ||
(loaded && (iLevel > getConfig().PATH_SEARCH_FAST)))
--iLevel;
}
else
{ // adjust as needed
if (!loaded && (iLevel < getConfig().PATH_SEARCH_MAX))
++iLevel;
if (loaded && (iLevel > getConfig().PATH_SEARCH_FAST))
--iLevel;
}
m_journal.debug << iIdentifier << " processing at level " << iLevel;
bool found = false;
for (auto const& currIssuer: sourceCurrencies)
{
{
STAmount test ({currIssuer.first, currIssuer.second}, 1);
if (m_journal.debug)
{
m_journal.debug
<< iIdentifier
<< " Trying to find paths: " << test.getFullText ();
}
}
bool valid;
STPathSet& spsPaths = mContext[currIssuer];
Pathfinder pf (cache, raSrcAccount, raDstAccount,
currIssuer.first, currIssuer.second, saDstAmount, valid);
CondLog (!valid, lsDEBUG, PathRequest)
<< iIdentifier << " PF request not valid";
STPath extraPath;
if (valid && pf.findPaths (iLevel, 4, spsPaths, extraPath))
{
LedgerEntrySet lesSandbox (cache->getLedger (), tapNONE);
PathState::List pathStateList;
STAmount saMaxAmountAct;
STAmount saDstAmountAct;
auto& account = currIssuer.second.isNonZero ()
? Account(currIssuer.second)
: isXRP (currIssuer.first)
//.........这里部分代码省略.........