mirror of
https://github.com/aljazceru/breez-sdk-liquid.git
synced 2026-01-31 11:54:24 +01:00
feat: require Breez API key globally on mainnet (#520)
This commit is contained in:
@@ -224,6 +224,7 @@ fun asConfig(config: ReadableMap): Config? {
|
||||
val network = config.getString("network")?.let { asLiquidNetwork(it) }!!
|
||||
val paymentTimeoutSec = config.getDouble("paymentTimeoutSec").toULong()
|
||||
val zeroConfMinFeeRateMsat = config.getInt("zeroConfMinFeeRateMsat").toUInt()
|
||||
val breezApiKey = if (hasNonNullKey(config, "breezApiKey")) config.getString("breezApiKey") else null
|
||||
val zeroConfMaxAmountSat =
|
||||
if (hasNonNullKey(
|
||||
config,
|
||||
@@ -234,7 +235,6 @@ fun asConfig(config: ReadableMap): Config? {
|
||||
} else {
|
||||
null
|
||||
}
|
||||
val breezApiKey = if (hasNonNullKey(config, "breezApiKey")) config.getString("breezApiKey") else null
|
||||
return Config(
|
||||
liquidElectrumUrl,
|
||||
bitcoinElectrumUrl,
|
||||
@@ -243,8 +243,8 @@ fun asConfig(config: ReadableMap): Config? {
|
||||
network,
|
||||
paymentTimeoutSec,
|
||||
zeroConfMinFeeRateMsat,
|
||||
zeroConfMaxAmountSat,
|
||||
breezApiKey,
|
||||
zeroConfMaxAmountSat,
|
||||
)
|
||||
}
|
||||
|
||||
@@ -257,8 +257,8 @@ fun readableMapOf(config: Config): ReadableMap =
|
||||
"network" to config.network.name.lowercase(),
|
||||
"paymentTimeoutSec" to config.paymentTimeoutSec,
|
||||
"zeroConfMinFeeRateMsat" to config.zeroConfMinFeeRateMsat,
|
||||
"zeroConfMaxAmountSat" to config.zeroConfMaxAmountSat,
|
||||
"breezApiKey" to config.breezApiKey,
|
||||
"zeroConfMaxAmountSat" to config.zeroConfMaxAmountSat,
|
||||
)
|
||||
|
||||
fun asConfigList(arr: ReadableArray): List<Config> {
|
||||
|
||||
@@ -57,12 +57,14 @@ class BreezSDKLiquidModule(
|
||||
@ReactMethod
|
||||
fun defaultConfig(
|
||||
network: String,
|
||||
breezApiKey: String,
|
||||
promise: Promise,
|
||||
) {
|
||||
executor.execute {
|
||||
try {
|
||||
val networkTmp = asLiquidNetwork(network)
|
||||
val res = defaultConfig(networkTmp)
|
||||
val breezApiKeyTmp = breezApiKey.takeUnless { it.isEmpty() }
|
||||
val res = defaultConfig(networkTmp, breezApiKeyTmp)
|
||||
val workingDir = File(reactApplicationContext.filesDir.toString() + "/breezSdkLiquid")
|
||||
|
||||
res.workingDir = workingDir.absolutePath
|
||||
|
||||
Reference in New Issue
Block a user