diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/Account.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/Account.kt index efb4208c5..9c335667e 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/Account.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/Account.kt @@ -89,6 +89,7 @@ import com.vitorpamplona.amethyst.model.topNavFeeds.IFeedTopNavFilter import com.vitorpamplona.amethyst.model.topNavFeeds.OutboxLoaderState import com.vitorpamplona.amethyst.model.torState.TorRelayState import com.vitorpamplona.amethyst.service.location.LocationState +import com.vitorpamplona.amethyst.service.relayClient.reqCommand.nwc.NWCPaymentFilterAssembler import com.vitorpamplona.amethyst.service.uploads.FileHeader import com.vitorpamplona.quartz.experimental.bounties.BountyAddValueEvent import com.vitorpamplona.quartz.experimental.edits.TextNoteModificationEvent @@ -218,7 +219,8 @@ import kotlin.coroutines.cancellation.CancellationException class Account( val settings: AccountSettings = AccountSettings(KeyPair()), val signer: NostrSigner, - geolocationFlow: StateFlow, + val geolocationFlow: StateFlow, + val nwcFilterAssembler: NWCPaymentFilterAssembler, val cache: LocalCache, val client: INostrClient, val scope: CoroutineScope, @@ -229,7 +231,7 @@ class Account( val userMetadata = UserMetadataState(signer, cache, scope, settings) - val nip47SignerState = NwcSignerState(signer, cache, scope, settings) + val nip47SignerState = NwcSignerState(signer, nwcFilterAssembler, cache, scope, settings) val nip65RelayList = Nip65RelayListState(signer, cache, scope, settings) val localRelayList = LocalRelayListState(signer, cache, scope, settings) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/nip47WalletConnect/NwcSignerState.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/nip47WalletConnect/NwcSignerState.kt index 1cfa440ae..cc59221ed 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/nip47WalletConnect/NwcSignerState.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/nip47WalletConnect/NwcSignerState.kt @@ -20,10 +20,10 @@ */ package com.vitorpamplona.amethyst.model.nip47WalletConnect -import com.vitorpamplona.amethyst.Amethyst import com.vitorpamplona.amethyst.model.AccountSettings import com.vitorpamplona.amethyst.model.LocalCache import com.vitorpamplona.amethyst.model.Note +import com.vitorpamplona.amethyst.service.relayClient.reqCommand.nwc.NWCPaymentFilterAssembler import com.vitorpamplona.amethyst.service.relayClient.reqCommand.nwc.NWCPaymentQueryState import com.vitorpamplona.quartz.nip01Core.core.hexToByteArray import com.vitorpamplona.quartz.nip01Core.crypto.KeyPair @@ -62,6 +62,7 @@ import kotlinx.coroutines.launch */ class NwcSignerState( val signer: NostrSigner, + val nwcFilterAssembler: NWCPaymentFilterAssembler, val cache: LocalCache, val scope: CoroutineScope, val settings: AccountSettings, @@ -163,13 +164,11 @@ class NwcSignerState( relay = walletService.relayUri, ) - Amethyst.instance.sources.nwc - .subscribe(filter) + nwcFilterAssembler.subscribe(filter) scope.launch(Dispatchers.IO) { delay(60000) // waits 1 minute to complete payment. - Amethyst.instance.sources.nwc - .unsubscribe(filter) + nwcFilterAssembler.unsubscribe(filter) } cache.consume(event, zappedNote, true, walletService.relayUri) {