@@ -11,14 +11,17 @@ import androidx.lifecycle.ViewModel
1111import androidx.lifecycle.viewModelScope
1212import androidx.navigation.NavOptions
1313import androidx.navigation.navOptions
14+ import com.synonym.bitkitcore.Activity
1415import com.synonym.bitkitcore.ActivityFilter
1516import com.synonym.bitkitcore.FeeRates
17+ import com.synonym.bitkitcore.LightningActivity
1618import com.synonym.bitkitcore.LightningInvoice
1719import com.synonym.bitkitcore.LnurlAuthData
1820import com.synonym.bitkitcore.LnurlChannelData
1921import com.synonym.bitkitcore.LnurlPayData
2022import com.synonym.bitkitcore.LnurlWithdrawData
2123import com.synonym.bitkitcore.OnChainInvoice
24+ import com.synonym.bitkitcore.PaymentState
2225import com.synonym.bitkitcore.PaymentType
2326import com.synonym.bitkitcore.Scanner
2427import com.synonym.bitkitcore.decode
@@ -54,12 +57,14 @@ import to.bitkit.di.BgDispatcher
5457import to.bitkit.env.Env
5558import to.bitkit.ext.WatchResult
5659import to.bitkit.ext.amountOnClose
60+ import to.bitkit.ext.amountSats
5761import to.bitkit.ext.getClipboardText
5862import to.bitkit.ext.getSatsPerVByteFor
5963import to.bitkit.ext.maxSendableSat
6064import to.bitkit.ext.maxWithdrawableSat
6165import to.bitkit.ext.minSendableSat
6266import to.bitkit.ext.minWithdrawableSat
67+ import to.bitkit.ext.nowTimestamp
6368import to.bitkit.ext.rawId
6469import to.bitkit.ext.removeSpaces
6570import to.bitkit.ext.setClipboardText
@@ -222,14 +227,33 @@ class AppViewModel @Inject constructor(
222227 is Event .ChannelReady -> {
223228 val channel = lightningRepo.getChannels()?.find { it.channelId == event.channelId }
224229 if (channel != null && blocktankRepo.isCjitOrder(channel)) {
230+ val amount = channel.amountOnClose.toLong()
225231 showNewTransactionSheet(
226232 NewTransactionSheetDetails (
227233 type = NewTransactionSheetType .LIGHTNING ,
228234 direction = NewTransactionSheetDirection .RECEIVED ,
229- sats = channel.amountOnClose.toLong() ,
235+ sats = amount ,
230236 ),
231237 event = event
232238 )
239+ val now = nowTimestamp().toEpochMilli().toULong()
240+ activityRepo.insertActivity(
241+ Activity .Lightning (
242+ LightningActivity (
243+ id = channel.fundingTxo?.txid.orEmpty(),
244+ txType = PaymentType .RECEIVED ,
245+ status = PaymentState .SUCCEEDED ,
246+ value = amount.toULong(),
247+ fee = 0U ,
248+ invoice = " Loading..." , // todo
249+ message = " " ,
250+ timestamp = now,
251+ preimage = null ,
252+ createdAt = now,
253+ updatedAt = null ,
254+ )
255+ )
256+ )
233257 } else {
234258 toast(
235259 type = Toast .ToastType .LIGHTNING ,
0 commit comments