-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathBlocktankRegtestViewModel.kt
More file actions
43 lines (37 loc) · 1.21 KB
/
BlocktankRegtestViewModel.kt
File metadata and controls
43 lines (37 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package to.bitkit.ui.settings
import androidx.lifecycle.ViewModel
import dagger.hilt.android.lifecycle.HiltViewModel
import to.bitkit.env.Defaults
import to.bitkit.services.CoreService
import javax.inject.Inject
@HiltViewModel
class BlocktankRegtestViewModel @Inject constructor(
private val coreService: CoreService,
) : ViewModel() {
suspend fun regtestMine(count: UInt = 1u) {
coreService.blocktank.regtestMine(count = count)
}
suspend fun regtestDeposit(address: String, amountSat: ULong = 10_000_000uL): String {
return coreService.blocktank.regtestDeposit(
address = address,
amountSat = amountSat,
)
}
suspend fun regtestPay(invoice: String, amountSat: ULong? = null): String {
return coreService.blocktank.regtestPay(
invoice = invoice,
amountSat = amountSat,
)
}
suspend fun regtestCloseChannel(
fundingTxId: String,
vout: UInt,
forceCloseAfterS: UInt = Defaults.bolt11ExpirySec,
): String {
return coreService.blocktank.regtestCloseChannel(
fundingTxId = fundingTxId,
vout = vout,
forceCloseAfterS = forceCloseAfterS,
)
}
}