@@ -86,7 +86,7 @@ class AppViewModel @Inject constructor(
8686 @ApplicationContext private val context : Context ,
8787 @BgDispatcher private val bgDispatcher : CoroutineDispatcher ,
8888 private val keychain : Keychain ,
89- private val lightningService : LightningRepo ,
89+ private val lightningRepo : LightningRepo ,
9090 private val walletRepo : WalletRepo ,
9191 private val coreService : CoreService ,
9292 private val ldkNodeEventBus : LdkNodeEventBus ,
@@ -200,7 +200,7 @@ class AppViewModel @Inject constructor(
200200
201201 is Event .ChannelReady -> {
202202 // TODO: handle ONLY cjit as payment received. This makes it look like any channel confirmed is a received payment.
203- val channel = lightningService .getChannels()?.find { it.channelId == event.channelId }
203+ val channel = lightningRepo .getChannels()?.find { it.channelId == event.channelId }
204204 if (channel != null ) {
205205 showNewTransactionSheet(
206206 NewTransactionSheetDetails (
@@ -403,12 +403,12 @@ class AppViewModel @Inject constructor(
403403 val lnurl = _sendUiState .value.lnurl
404404
405405 val isValidLNAmount = when (lnurl) {
406- null -> lightningService .canSend(amount)
406+ null -> lightningRepo .canSend(amount)
407407 is LnurlParams .LnurlPay -> {
408408 val minSat = lnurl.data.minSendableSat()
409409 val maxSat = lnurl.data.maxSendableSat()
410410
411- amount in minSat.. maxSat && lightningService .canSend(amount)
411+ amount in minSat.. maxSat && lightningRepo .canSend(amount)
412412 }
413413
414414 is LnurlParams .LnurlWithdraw -> {
@@ -531,7 +531,7 @@ class AppViewModel @Inject constructor(
531531 val quickPayHandled = handleQuickPayIfApplicable(amountSats = invoice.amountSatoshis, invoice = invoice)
532532 if (quickPayHandled) return
533533
534- if (! lightningService .canSend(invoice.amountSatoshis)) {
534+ if (! lightningRepo .canSend(invoice.amountSatoshis)) {
535535 toast(
536536 type = Toast .ToastType .ERROR ,
537537 title = " Insufficient Funds" ,
@@ -574,7 +574,7 @@ class AppViewModel @Inject constructor(
574574 val minSendable = data.minSendableSat()
575575 val maxSendable = data.maxSendableSat()
576576
577- if (! lightningService .canSend(minSendable)) {
577+ if (! lightningRepo .canSend(minSendable)) {
578578 toast(
579579 type = Toast .ToastType .WARNING ,
580580 title = context.getString(R .string.other__lnurl_pay_error),
@@ -662,7 +662,7 @@ class AppViewModel @Inject constructor(
662662 fun requestLnurlAuth (callback : String , k1 : String , domain : String ) {
663663 viewModelScope.launch {
664664 // TODO pass callback and domain from bitkit-core when updated to accept decoded callback and return domain
665- lightningService .requestLnurlAuth(
665+ lightningRepo .requestLnurlAuth(
666666 callback = callback,
667667 k1 = k1,
668668 domain = domain,
@@ -803,7 +803,7 @@ class AppViewModel @Inject constructor(
803803
804804 if (_sendUiState .value.payMethod != SendMethod .ONCHAIN ) return
805805
806- val totalFee = lightningService .calculateTotalFee(
806+ val totalFee = lightningRepo .calculateTotalFee(
807807 amountSats = amountSats,
808808 address = _sendUiState .value.address,
809809 speed = _sendUiState .value.speed,
@@ -841,7 +841,7 @@ class AppViewModel @Inject constructor(
841841 val isLnurlPay = lnurl is LnurlParams .LnurlPay
842842
843843 if (isLnurlPay) {
844- lightningService .fetchLnurlInvoice(
844+ lightningRepo .fetchLnurlInvoice(
845845 callbackUrl = lnurl.data.callback,
846846 amountSats = amount,
847847 comment = _sendUiState .value.comment.takeIf { it.isNotEmpty() },
@@ -942,7 +942,7 @@ class AppViewModel @Inject constructor(
942942 )
943943 }
944944
945- val invoice = lightningService .createInvoice(
945+ val invoice = lightningRepo .createInvoice(
946946 amountSats = _sendUiState .value.amount,
947947 description = lnurl.data.defaultDescription,
948948 expirySeconds = 3600u ,
@@ -954,7 +954,7 @@ class AppViewModel @Inject constructor(
954954 return @launch
955955 }
956956
957- lightningService .requestLnurlWithdraw(
957+ lightningRepo .requestLnurlWithdraw(
958958 k1 = lnurl.data.k1,
959959 callback = lnurl.data.callback,
960960 paymentRequest = invoice
@@ -994,7 +994,7 @@ class AppViewModel @Inject constructor(
994994
995995 private suspend fun sendOnchain (address : String , amount : ULong ): Result <Txid > {
996996 val utxos = _sendUiState .value.selectedUtxos
997- return lightningService .sendOnChain(
997+ return lightningRepo .sendOnChain(
998998 address = address,
999999 sats = amount,
10001000 utxosToSpend = utxos,
@@ -1005,7 +1005,7 @@ class AppViewModel @Inject constructor(
10051005 bolt11 : String ,
10061006 amount : ULong? = null,
10071007 ): Result <PaymentId > {
1008- return lightningService .payInvoice(bolt11 = bolt11, sats = amount).onSuccess { hash ->
1008+ return lightningRepo .payInvoice(bolt11 = bolt11, sats = amount).onSuccess { hash ->
10091009 // Wait until matching payment event is received
10101010 val result = ldkNodeEventBus.events.watchUntil { event ->
10111011 when (event) {
0 commit comments