damus

nostr ios client
git clone git://jb55.com/damus
Log | Files | Refs | README | LICENSE

commit 28f292f692e924fc0bf305c649e342ffffb192be
parent 4defab73d0bc70804b0f151f7f95ad927be7e420
Author: William Casarin <jb55@jb55.com>
Date:   Fri,  2 Feb 2024 12:01:00 -0800

nostrscript: fix nscripts not loading

This was broken by the recent nip19 changes, let's fix it again

Fixes: cb4adf06f12b ("nip19: added swift enums")
Changelog-Fixed: Fix nostrscripts not loading
Signed-off-by: William Casarin <jb55@jb55.com>

Diffstat:
Mdamus/Util/Bech32Object.swift | 8++++++--
1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/damus/Util/Bech32Object.swift b/damus/Util/Bech32Object.swift @@ -70,10 +70,14 @@ enum Bech32Object : Equatable { case nprofile(NProfile) case nrelay(String) case naddr(NAddr) - + static func parse(_ str: String) -> Bech32Object? { + if str.starts(with: "nscript"), let decoded = try? bech32_decode(str) { + return .nscript(decoded.data.bytes) + } + var b: nostr_bech32_t = nostr_bech32() - + let bytes = Array(str.utf8) bytes.withUnsafeBufferPointer { buffer in