Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .claude/plugins/blocktank-api/skills/lsp/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ version: 0.1.0

Blocktank is the Lightning Service Provider (LSP) used by Bitkit. This skill provides full knowledge of its REST API and a utility script to call any endpoint from the command line.

All requests and responses use JSON. Staging's `/regtest/*` routes need basic auth: set `BLOCKTANK_REGTEST_AUTH=user:password` and the script sends it; without it they return `401`. Other routes need no authentication.
All requests and responses use JSON. Staging's `/regtest/*` routes need basic auth: set `BLOCKTANK_REGTEST_AUTH=user:password` and the script sends it; without it they return `401`. Other routes need no authentication. Debug builds of the app send the same value from Settings > Blocktank Regtest when `BLOCKTANK_REGTEST_AUTH` is set at build time (environment variable, Gradle property or `local.properties`); release builds never carry it.

## Configuration

Expand Down
4 changes: 2 additions & 2 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ androidComponents {
buildConfigFields.put("E2E_HOMEGATE_URL", e2eHomegateUrlEnv.stringField())
buildConfigFields.put("E2E_HOMESERVER_PUBKY", e2eHomeserverPubkyEnv.stringField())
buildConfigFields.put("E2E_HOMEGATE_OVERRIDE", e2eHomegateOverrideEnv.stringField())
for (key in listOf("E2E_VSS_SERVER_URL", "E2E_LNURL_AUTH_SERVER_URL", "E2E_BLOCKTANK_API_URL")) {
for (key in listOf("E2E_VSS_SERVER_URL", "E2E_LNURL_AUTH_SERVER_URL", "E2E_BLOCKTANK_API_URL", "BLOCKTANK_REGTEST_AUTH")) {
val value = if (variant.buildType == "debug") localProp(key).orElse("") else provider { "" }
buildConfigFields.put(key, value.stringField())
Comment thread
ovitrif marked this conversation as resolved.
Resolved
}
Expand Down Expand Up @@ -417,7 +417,7 @@ androidComponents {
}

fun Provider<String>.stringField(): Provider<BuildConfigField<String>> =
map { BuildConfigField(type = "String", value = "\"$it\"", comment = null) }
map { BuildConfigField(type = "String", value = "\"${it.replace("\\", "\\\\").replace("\"", "\\\"")}\"", comment = null) }

fun Provider<String>.booleanField(): Provider<BuildConfigField<String>> =
map { BuildConfigField(type = "boolean", value = it, comment = null) }
Expand Down
3 changes: 3 additions & 0 deletions app/src/main/java/to/bitkit/env/Env.kt
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ internal object Env {
get() = BuildConfig.ESPLORA_URL.takeIf { it.isNotBlank() && network == Network.REGTEST }

val isDebug = BuildConfig.DEBUG

/** Basic auth (`user:password`) for Blocktank's regtest routes, set only in debug builds. */
val blocktankRegtestAuth: String? get() = BuildConfig.BLOCKTANK_REGTEST_AUTH.takeIf { isDebug && it.isNotBlank() }
const val isE2eTest = BuildConfig.E2E
val e2eBackend = BuildConfig.E2E_BACKEND.lowercase()
val isLocalE2eBackend = isE2eTest && e2eBackend == "local"
Expand Down
5 changes: 4 additions & 1 deletion app/src/main/java/to/bitkit/services/CoreService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2270,20 +2270,22 @@ class BlocktankService(

// MARK: - Regtest methods
suspend fun regtestMine(count: UInt = 1u) {
com.synonym.bitkitcore.regtestMine(count = count)
com.synonym.bitkitcore.regtestMine(count = count, auth = Env.blocktankRegtestAuth)
}

suspend fun regtestDeposit(address: String, amountSat: ULong = 10_000_000uL): String {
return com.synonym.bitkitcore.regtestDeposit(
address = address,
amountSat = amountSat,
auth = Env.blocktankRegtestAuth,
)
}

suspend fun regtestPay(invoice: String, amountSat: ULong? = null): String {
return com.synonym.bitkitcore.regtestPay(
invoice = invoice,
amountSat = amountSat,
auth = Env.blocktankRegtestAuth,
)
}

Expand All @@ -2296,6 +2298,7 @@ class BlocktankService(
fundingTxId = fundingTxId,
vout = vout,
forceCloseAfterS = forceCloseAfterS.toULong(),
auth = Env.blocktankRegtestAuth,
)
}
}
Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ activity-compose = { module = "androidx.activity:activity-compose", version = "1
appcompat = { module = "androidx.appcompat:appcompat", version = "1.8.0" }
barcode-scanning = { module = "com.google.mlkit:barcode-scanning", version = "17.3.0" }
biometric = { module = "androidx.biometric:biometric", version = "1.4.0-beta01" }
bitkit-core = { module = "com.synonym:bitkit-core-android", version = "0.8.0-rc13" }
bitkit-core = { module = "com.synonym:bitkit-core-android", version = "0.8.0-rc14" }
breez-sdk-spark = { module = "breez_sdk_spark:bindings-android", version = "0.28.0" }
paykit = { module = "com.synonym:paykit-android", version = "0.1.1-rc7" }
bouncycastle-pkix-jdk = { module = "org.bouncycastle:bcpkix-jdk18on", version = "1.86" }
Expand Down
Loading