fix
This commit is contained in:
parent
98f7763d69
commit
a6d6384e8c
@ -3,7 +3,7 @@ import FormModal from "./FormModal";
|
|||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { useModal } from "@/app/_providers/modal/provider";
|
import { useModal } from "@/app/_providers/modal/provider";
|
||||||
import { toast } from "sonner";
|
import { toast } from "sonner";
|
||||||
import { generateRandomStringLength } from "@/lib/nostr";
|
import { randomId } from "@/lib/nostr";
|
||||||
import { satsToBtc } from "@/lib/utils";
|
import { satsToBtc } from "@/lib/utils";
|
||||||
import useCurrentUser from "@/lib/hooks/useCurrentUser";
|
import useCurrentUser from "@/lib/hooks/useCurrentUser";
|
||||||
import { useNDK } from "@/app/_providers/ndk";
|
import { useNDK } from "@/app/_providers/ndk";
|
||||||
@ -34,7 +34,7 @@ export default function CreateList() {
|
|||||||
const { getSigner } = useSigner()!;
|
const { getSigner } = useSigner()!;
|
||||||
async function handleSubmit(data: CreateListType) {
|
async function handleSubmit(data: CreateListType) {
|
||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
const random = generateRandomStringLength(8);
|
const random = randomId();
|
||||||
const tags = [
|
const tags = [
|
||||||
["title", data.title],
|
["title", data.title],
|
||||||
["name", data.title],
|
["name", data.title],
|
||||||
|
@ -7,11 +7,7 @@ import NDK, {
|
|||||||
type NostrEvent,
|
type NostrEvent,
|
||||||
NDKUser,
|
NDKUser,
|
||||||
} from "@nostr-dev-kit/ndk";
|
} from "@nostr-dev-kit/ndk";
|
||||||
import {
|
import { generateRandomString, encryptMessage, randomId } from "@/lib/nostr";
|
||||||
generateRandomString,
|
|
||||||
encryptMessage,
|
|
||||||
generateRandomStringLength,
|
|
||||||
} from "@/lib/nostr";
|
|
||||||
import { unixTimeNowInSeconds } from "@/lib/nostr/dates";
|
import { unixTimeNowInSeconds } from "@/lib/nostr/dates";
|
||||||
import { getTagsValues } from "@/lib/nostr/utils";
|
import { getTagsValues } from "@/lib/nostr/utils";
|
||||||
|
|
||||||
@ -159,7 +155,7 @@ export async function createList(
|
|||||||
tags: [
|
tags: [
|
||||||
["name", title],
|
["name", title],
|
||||||
["description", description ?? ""],
|
["description", description ?? ""],
|
||||||
["d", generateRandomStringLength(8)],
|
["d", randomId()],
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -146,6 +146,7 @@ function create32ByteBuffer(inputString: string) {
|
|||||||
export function generateRandomString() {
|
export function generateRandomString() {
|
||||||
return crypto.randomBytes(32).toString("hex");
|
return crypto.randomBytes(32).toString("hex");
|
||||||
}
|
}
|
||||||
export function generateRandomStringLength(length: number) {
|
|
||||||
return crypto.randomBytes(length).toString("hex");
|
export function randomId(): string {
|
||||||
|
return crypto.randomBytes(32).toString("hex").slice(0, 8);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user