feat: add missing alt tag to PaymentTargetsEvent
Adds ALT constant, FIXED_D_TAG constant, and AltTag import to
PaymentTargetsEvent. The alt tag ("Payment targets") is now included
in both create() and updatePaymentTargets() methods.
https://claude.ai/code/session_013SQtN37Qemiu3vxjXZDbQj
This commit is contained in:
+5
-1
@@ -24,6 +24,7 @@ import com.vitorpamplona.quartz.nip01Core.core.Address
|
||||
import com.vitorpamplona.quartz.nip01Core.core.BaseReplaceableEvent
|
||||
import com.vitorpamplona.quartz.nip01Core.core.HexKey
|
||||
import com.vitorpamplona.quartz.nip01Core.signers.NostrSigner
|
||||
import com.vitorpamplona.quartz.nip31Alts.AltTag
|
||||
import com.vitorpamplona.quartz.utils.TimeUtils
|
||||
|
||||
class PaymentTargetsEvent(
|
||||
@@ -36,6 +37,8 @@ class PaymentTargetsEvent(
|
||||
) : BaseReplaceableEvent(id, pubKey, createdAt, KIND, tags, content, sig) {
|
||||
companion object {
|
||||
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)
|
||||
|
||||
@@ -49,12 +52,13 @@ class PaymentTargetsEvent(
|
||||
earlierVersion.tags
|
||||
.filter(PaymentTargetTag::notMatch)
|
||||
.plus(targets.map { PaymentTargetTag.assemble(it) })
|
||||
.plus(AltTag.assemble(ALT))
|
||||
.toTypedArray()
|
||||
|
||||
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(
|
||||
targets: List<PaymentTarget>,
|
||||
|
||||
Reference in New Issue
Block a user