Add relay hints to tags and identifiers

Changelog-Added: Add relay hints to tags and identifiers
Signed-off-by: Terry Yiu <git@tyiu.xyz>
This commit is contained in:
2025-07-13 01:45:16 -04:00
parent 3ddb2625e9
commit eddd908fa3
16 changed files with 149 additions and 53 deletions

View File

@@ -167,7 +167,23 @@ class Bech32ObjectTests: XCTestCase {
XCTAssertEqual(expectedEncoding, actualEncoding)
}
func testTLVEncoding_NeventFromNostrEvent_ValidContent() throws {
let relays = ["wss://relay.damus.io", "wss://relay.nostr.band"]
let nevent = NEvent(event: test_note, relays: relays)
XCTAssertEqual(nevent.noteid, test_note.id)
XCTAssertEqual(nevent.relays, relays)
XCTAssertEqual(nevent.author, test_note.pubkey)
XCTAssertEqual(nevent.kind, test_note.kind)
let expectedEncoding = "nevent1qqsqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpz3mhxue69uhhyetvv9ujuerpd46hxtnfduq3vamnwvaz7tmjv4kxz7fwdehhxarj9e3xzmnyqgsgydql3q4ka27d9wnlrmus4tvkrnc8ftc4h8h5fgyln54gl0a7dgsrqsqqqqqpppe7n6"
let actualEncoding = Bech32Object.encode(.nevent(NEvent(event: test_note, relays: relays)))
XCTAssertEqual(expectedEncoding, actualEncoding)
}
func testTLVEncoding_NProfileExample_ValidContent() throws {
guard let author = try bech32_decode("npub180cvv07tjdrrgpa0j7j7tmnyl2yr6yr7l8j4s3evf6u64th6gkwsyjh6w6") else {
XCTFail()