MCPcopy Create free account
hub / github.com/ElementsProject/elements / AmountFromValue

Function AmountFromValue

src/rpc/util.cpp:93–103  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

91}
92
93CAmount AmountFromValue(const UniValue& value, bool check_range, int decimals)
94{
95 if (!value.isNum() && !value.isStr())
96 throw JSONRPCError(RPC_TYPE_ERROR, "Amount is not a number or string");
97 CAmount amount;
98 if (!ParseFixedPoint(value.getValStr(), decimals, &amount))
99 throw JSONRPCError(RPC_TYPE_ERROR, "Invalid amount");
100 if (amount < 0 || (check_range && !MoneyRange(amount)))
101 throw JSONRPCError(RPC_TYPE_ERROR, "Amount out of range");
102 return amount;
103}
104
105uint256 ParseHashV(const UniValue& v, std::string strName)
106{

Callers 15

sendrawtransactionFunction · 0.70
testmempoolacceptFunction · 0.70
rawblindrawtransactionFunction · 0.70
rawissueassetFunction · 0.70
rawreissueassetFunction · 0.70
updatepsbtpeginFunction · 0.70
ConstructTransactionFunction · 0.70
ParsePrevoutsFunction · 0.70
listunspentFunction · 0.50
ParseRecipientsFunction · 0.50
SetFeeEstimateModeFunction · 0.50
settxfeeFunction · 0.50

Calls 5

JSONRPCErrorFunction · 0.85
ParseFixedPointFunction · 0.85
isNumMethod · 0.80
isStrMethod · 0.80
MoneyRangeFunction · 0.50

Tested by 3

BOOST_AUTO_TEST_CASEFunction · 0.40
BOOST_AUTO_TEST_CASEFunction · 0.40
FUZZ_TARGET_INITFunction · 0.40