Skip to content

Commit 98b9fe1

Browse files
ovitrifclaude
andcommitted
fix: address pr review comments
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 46e222d commit 98b9fe1

2 files changed

Lines changed: 19 additions & 21 deletions

File tree

.claude/plugins/blocktank-api/skills/lsp/scripts/pay-invoices.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,4 +95,4 @@ if [ "$batches" -gt 0 ]; then
9595
fi
9696

9797
echo ""
98-
echo "=== Done: $INVOICE_COUNT invoices paid, $MINE_TOTAL blocks mined ==="
98+
echo "=== Done: $INVOICE_COUNT invoices paid, $((batches * MINE_BATCH)) blocks mined ==="

app/src/debug/java/to/bitkit/dev/DevToolsProvider.kt

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class DevToolsProvider : ContentProvider() {
2323
}
2424

2525
private val deps: Dependencies by lazy {
26-
EntryPointAccessors.fromApplication(context!!, Dependencies::class.java)
26+
EntryPointAccessors.fromApplication(requireNotNull(context), Dependencies::class.java)
2727
}
2828

2929
override fun call(method: String, arg: String?, extras: Bundle?): Bundle = runCatching {
@@ -43,9 +43,21 @@ class DevToolsProvider : ContentProvider() {
4343

4444
private sealed interface DevCommand {
4545

46+
companion object {
47+
fun parse(method: String, arg: String?): DevCommand? = when (method) {
48+
CreateInvoice.METHOD -> CreateInvoice.parse(arg)
49+
else -> null
50+
}
51+
}
52+
4653
suspend fun execute(deps: DevToolsProvider.Dependencies): DevResult
4754

4855
data class CreateInvoice(val args: Args) : DevCommand {
56+
companion object {
57+
const val METHOD = "createInvoice"
58+
fun parse(arg: String?) = CreateInvoice(arg.deserialize<Args>())
59+
}
60+
4961
@Serializable
5062
data class Args(val amount: ULong? = null, val description: String = "dev-invoice")
5163

@@ -54,34 +66,20 @@ private sealed interface DevCommand {
5466
onSuccess = { DevResult.Invoice(it) },
5567
onFailure = { DevResult.Error(it.message) },
5668
)
57-
58-
companion object {
59-
const val METHOD = "createInvoice"
60-
fun parse(arg: String?) = CreateInvoice(arg.deserialize<Args>())
61-
}
62-
}
63-
64-
companion object {
65-
fun parse(method: String, arg: String?): DevCommand? = when (method) {
66-
CreateInvoice.METHOD -> CreateInvoice.parse(arg)
67-
else -> null
68-
}
6969
}
7070
}
7171

7272
@Serializable
7373
private sealed interface DevResult {
74-
@Serializable
75-
data class Invoice(val bolt11: String) : DevResult
76-
77-
@Serializable
78-
data class Error(val message: String? = null) : DevResult
79-
80-
fun toBundle() = bundleOf(KEY_RESULT to Json.encodeToString(this))
8174

8275
companion object {
8376
private const val KEY_RESULT = "result"
8477
}
78+
79+
@Serializable data class Invoice(val bolt11: String) : DevResult
80+
@Serializable data class Error(val message: String? = null) : DevResult
81+
82+
fun toBundle() = bundleOf(KEY_RESULT to Json.encodeToString(this))
8583
}
8684

8785
private inline fun <reified T> String?.deserialize(): T =

0 commit comments

Comments
 (0)