Merge pull request #2148 from greenart7c3/claude/add-alt-tag-payment-eyb1R

Add ALT tag support to PaymentTargetsEvent
This commit is contained in:
Vitor Pamplona
2026-04-05 16:39:59 -04:00
committed by GitHub
@@ -24,6 +24,7 @@ import com.vitorpamplona.quartz.nip01Core.core.Address
import com.vitorpamplona.quartz.nip01Core.core.BaseReplaceableEvent import com.vitorpamplona.quartz.nip01Core.core.BaseReplaceableEvent
import com.vitorpamplona.quartz.nip01Core.core.HexKey import com.vitorpamplona.quartz.nip01Core.core.HexKey
import com.vitorpamplona.quartz.nip01Core.signers.NostrSigner import com.vitorpamplona.quartz.nip01Core.signers.NostrSigner
import com.vitorpamplona.quartz.nip31Alts.AltTag
import com.vitorpamplona.quartz.utils.TimeUtils import com.vitorpamplona.quartz.utils.TimeUtils
class PaymentTargetsEvent( class PaymentTargetsEvent(
@@ -38,6 +39,8 @@ class PaymentTargetsEvent(
companion object { companion object {
const val KIND = 10133 const val KIND = 10133
const val ALT = "Payment targets"
const val FIXED_D_TAG = ""
fun createAddress(pubKey: HexKey): Address = Address(KIND, pubKey, FIXED_D_TAG) fun createAddress(pubKey: HexKey): Address = Address(KIND, pubKey, FIXED_D_TAG)
@@ -51,12 +54,13 @@ class PaymentTargetsEvent(
earlierVersion.tags earlierVersion.tags
.filter(PaymentTargetTag::notMatch) .filter(PaymentTargetTag::notMatch)
.plus(targets.map { PaymentTargetTag.assemble(it) }) .plus(targets.map { PaymentTargetTag.assemble(it) })
.plus(AltTag.assemble(ALT))
.toTypedArray() .toTypedArray()
return signer.sign(createdAt, KIND, tags, earlierVersion.content) return signer.sign(createdAt, KIND, tags, earlierVersion.content)
} }
fun createPaymentTargets(targets: List<PaymentTarget>) = targets.map { PaymentTargetTag.assemble(it) }.toTypedArray() fun createPaymentTargets(targets: List<PaymentTarget>) = (targets.map { PaymentTargetTag.assemble(it) } + listOf(AltTag.assemble(ALT))).toTypedArray()
suspend fun create( suspend fun create(
targets: List<PaymentTarget>, targets: List<PaymentTarget>,