Store tx hash as image file name in pinata

This commit is contained in:
Shreerang Kale committed 2025-02-07 09:39:21 +05:30
1 parent d3e6f7ad12
commit 77fe9edf9b
2 files changed
+3 -3

No files matched your search

+1 -1
View File
@@ -97,7 +97,7 @@ export async function POST(req: NextRequest): Promise<NextResponse> {
)
}
const pinataResult = await uploadToPinata(imageUrl);
const pinataResult = await uploadToPinata(imageUrl, transactionSignature);
if (pinataResult.error) {
return NextResponse.json(
+2 -2
View File
@@ -12,9 +12,9 @@ const pinata = new PinataSDK({
pinataGateway: process.env.PINATA_GATEWAY,
});
export async function uploadToPinata(imageUrl: string): Promise<FluxGenerationResult> {
export async function uploadToPinata(imageUrl: string, transactionSignature: string): Promise<FluxGenerationResult> {
try {
const upload = await pinata.upload.url(imageUrl);
const upload = await pinata.upload.url(imageUrl, { metadata: { name: transactionSignature }});
const publicURL = await pinata.gateways.convert(upload.IpfsHash);