| 96 | } |
| 97 | |
| 98 | CAmount AmountFromValue(const UniValue& value, int decimals) |
| 99 | { |
| 100 | if (!value.isNum() && !value.isStr()) |
| 101 | throw JSONRPCError(RPC_TYPE_ERROR, "Amount is not a number or string"); |
| 102 | int64_t amount; |
| 103 | if (!ParseFixedPoint(value.getValStr(), decimals, &amount)) |
| 104 | throw JSONRPCError(RPC_TYPE_ERROR, "Invalid amount"); |
| 105 | if (!MoneyRange(amount)) |
| 106 | throw JSONRPCError(RPC_TYPE_ERROR, "Amount out of range"); |
| 107 | return amount; |
| 108 | } |
| 109 | |
| 110 | CFeeRate ParseFeeRate(const UniValue& json) |
| 111 | { |