feat: update rust nostr

This commit is contained in:
2024-02-06 19:28:46 +07:00
parent a4069dae99
commit 3c4bd39384
22 changed files with 721 additions and 1114 deletions

View File

@@ -6,7 +6,7 @@ export function useEvent(id: string) {
const { isLoading, isError, data } = useQuery({
queryKey: ["event", id],
queryFn: async () => {
const event = await ark.getEventById(id);
const event = await ark.get_event(id);
if (!event)
throw new Error(
`Cannot get event with ${id}, will be retry after 10 seconds`,

View File

@@ -1,11 +1,8 @@
import { NDKUserProfile } from "@nostr-dev-kit/ndk";
import { useQuery, useQueryClient } from "@tanstack/react-query";
import { useArk } from "./useArk";
export function useProfile(pubkey: string) {
const ark = useArk();
const queryClient = useQueryClient();
const {
isLoading,
isError,
@@ -13,16 +10,13 @@ export function useProfile(pubkey: string) {
} = useQuery({
queryKey: ["user", pubkey],
queryFn: async () => {
const profile = await ark.getUserProfile(pubkey);
const profile = await ark.get_metadata(pubkey);
if (!profile)
throw new Error(
`Cannot get metadata for ${pubkey}, will be retry after 10 seconds`,
);
return profile;
},
initialData: () => {
return queryClient.getQueryData(["user", pubkey]) as NDKUserProfile;
},
refetchOnMount: false,
refetchOnWindowFocus: false,
refetchOnReconnect: false,