Fix handling of f32 type (#336)

This commit is contained in:
Ross Savage
2024-06-27 13:07:41 +02:00
committed by GitHub
parent 5023248545
commit a4af73352a
3 changed files with 4 additions and 2 deletions

View File

@@ -212,7 +212,7 @@ pub mod filters {
Type::Int32 => format!("{name}.getInt(\"{field_name}\")"),
Type::UInt64 => format!("{name}.getDouble(\"{field_name}\").toULong()"),
Type::Int64 => format!("{name}.getDouble(\"{field_name}\").toLong()"),
Type::Float32 => format!("{name}.getDouble(\"{field_name}\")"),
Type::Float32 => format!("{name}.getDouble(\"{field_name}\").toFloat()"),
Type::Float64 => format!("{name}.getDouble(\"{field_name}\")"),
Type::Boolean => format!("{name}.getBoolean(\"{field_name}\")"),
Type::String => format!("{name}.getString(\"{field_name}\"){mandatory_suffix}"),

View File

@@ -36,6 +36,7 @@ fun pushToMap(map: WritableMap, key: String, value: Any?) {
is Boolean -> map.putBoolean(key, value)
is Byte -> map.putInt(key, value.toInt())
is Double -> map.putDouble(key, value)
is Float -> map.putDouble(key, value.toDouble())
is Int -> map.putInt(key, value)
is Long -> map.putDouble(key, value.toDouble())
is ReadableArray -> map.putArray(key, value)

View File

@@ -134,7 +134,7 @@ fun asConfig(config: ReadableMap): Config? {
val workingDir = config.getString("workingDir")!!
val network = config.getString("network")?.let { asLiquidNetwork(it) }!!
val paymentTimeoutSec = config.getDouble("paymentTimeoutSec").toULong()
val zeroConfMinFeeRate = config.getDouble("zeroConfMinFeeRate")
val zeroConfMinFeeRate = config.getDouble("zeroConfMinFeeRate").toFloat()
val zeroConfMaxAmountSat =
if (hasNonNullKey(
config,
@@ -2331,6 +2331,7 @@ fun pushToMap(
is Boolean -> map.putBoolean(key, value)
is Byte -> map.putInt(key, value.toInt())
is Double -> map.putDouble(key, value)
is Float -> map.putDouble(key, value.toDouble())
is Int -> map.putInt(key, value)
is Long -> map.putDouble(key, value.toDouble())
is ReadableArray -> map.putArray(key, value)