File tree Expand file tree Collapse file tree 2 files changed +8
-10
lines changed
app/src/main/java/to/bitkit Expand file tree Collapse file tree 2 files changed +8
-10
lines changed Original file line number Diff line number Diff line change @@ -97,13 +97,11 @@ class BlocktankRepo @Inject constructor(
9797 }
9898 }
9999
100- suspend fun isCjitOrder (channel : ChannelDetails ): Boolean = withContext(bgDispatcher) {
101- return @withContext runCatching {
102- _blocktankState .value.cjitEntries.any { order ->
103- order.channelSizeSat == channel.channelValueSats &&
104- order.lspNode.pubkey == channel.counterpartyNodeId
105- }
106- }.getOrDefault(false )
100+ suspend fun getCjitOrder (channel : ChannelDetails ): IcJitEntry ? = withContext(bgDispatcher) {
101+ return @withContext _blocktankState .value.cjitEntries.firstOrNull { order ->
102+ order.channelSizeSat == channel.channelValueSats &&
103+ order.lspNode.pubkey == channel.counterpartyNodeId
104+ }
107105 }
108106
109107 suspend fun refreshInfo () = withContext(bgDispatcher) {
Original file line number Diff line number Diff line change @@ -57,7 +57,6 @@ import to.bitkit.di.BgDispatcher
5757import to.bitkit.env.Env
5858import to.bitkit.ext.WatchResult
5959import to.bitkit.ext.amountOnClose
60- import to.bitkit.ext.amountSats
6160import to.bitkit.ext.getClipboardText
6261import to.bitkit.ext.getSatsPerVByteFor
6362import to.bitkit.ext.maxSendableSat
@@ -226,7 +225,8 @@ class AppViewModel @Inject constructor(
226225
227226 is Event .ChannelReady -> {
228227 val channel = lightningRepo.getChannels()?.find { it.channelId == event.channelId }
229- if (channel != null && blocktankRepo.isCjitOrder(channel)) {
228+ val cjitOrder = channel?.let { blocktankRepo.getCjitOrder(it) }
229+ if (cjitOrder != null ) {
230230 val amount = channel.amountOnClose.toLong()
231231 showNewTransactionSheet(
232232 NewTransactionSheetDetails (
@@ -245,7 +245,7 @@ class AppViewModel @Inject constructor(
245245 status = PaymentState .SUCCEEDED ,
246246 value = amount.toULong(),
247247 fee = 0U ,
248- invoice = " Loading... " , // todo
248+ invoice = cjitOrder.invoice.request,
249249 message = " " ,
250250 timestamp = now,
251251 preimage = null ,
You can’t perform that action at this time.
0 commit comments