fix: use encodeTLV

This commit is contained in:
Alejandro Gomez
2023-06-24 13:19:11 +02:00
parent 28e8b5fffa
commit d3b18850ad
4 changed files with 6 additions and 52 deletions

View File

@ -1,7 +1,6 @@
import { Icon } from "element/icon";
import "./layout.css";
import { EventPublisher, NostrEvent } from "@snort/system";
import { nip19 } from "nostr-tools";
import { EventPublisher, NostrEvent, encodeTLV, NostrPrefix } from "@snort/system";
import { Outlet, useNavigate } from "react-router-dom";
import AsyncButton from "element/async-button";
import { Login } from "index";
@ -60,12 +59,8 @@ export function LayoutPage() {
}
function goToStream(ev: NostrEvent) {
const addr = {
pubkey: ev.pubkey,
kind: ev.kind,
identifier: ev.tags.find(t => t.at(0) === "d")?.at(1) || "",
}
const naddr = nip19.naddrEncode(addr)
const d = ev.tags.find(t => t.at(0) === "d")?.at(1) || ""
const naddr = encodeTLV(NostrPrefix.Address, d, undefined, ev.kind, ev.pubkey)
navigate(`/live/${naddr}`);
setNewStream(false)
}